我有一個Solr MoreLike這個查詢產生了一些確定無關的結果。當我查看該查詢的調試時,我可以看到該查詢在換行符上匹配。Solr MoreLikeThis查詢匹配換行符
這裏的查詢:
MLT Q = is_lesson_id:49029 &開始= 0 &行數= 3 & FL = *,得分&重量= JSON & FQ = sm_sitename {標籤=網站!}:(FCM OR BCM OR CCM)& mlt.interestingTerms =細節& mlt.match.include =假& mlt.match.offset = 0 & mlt.fl =標題,正文& mlt.mintf = 2 & mlt.mindf = 1個& MLT。 minwl = 4 & mlt.boost = true & mlt.qf = title^1000 body &縮進=上& debugQuery =上
這裏的解釋:
"interestingTerms":[
"body:rabbit",1.0,
"body:bunni",0.8582874,
"body:easter",0.7999738,
"body: ",0.5719101,
"body:ampampnbsp",0.51804715,
"body:nbsp",0.36014518],
"debug":{
"rawquerystring":"is_lesson_id:49029",
"querystring":"is_lesson_id:49029",
"parsedquery":"body:rabbit body:bunni^0.8582874
body:easter^0.7999738
body: ^0.5719101
body:ampampnbsp^0.51804715
body:nbsp^0.36014518",
"parsedquery_toString":"body:rabbit
body:bunni^0.8582874
body:easter^0.7999738
body: ^0.5719101
body:ampampnbsp^0.51804715
body:nbsp^0.36014518",
"explain":{
"p5zqzz/node/681":"\n0.14956066 = (MATCH) product of:\n 0.44868195 = (MATCH) sum of:\n 0.20911716 = (MATCH) weight(body:bunni^0.8582874 in 327), product of:\n 0.5523649 = queryWeight(body:bunni^0.8582874), product of:\n 0.8582874 = boost\n 6.9227004 = idf(docFreq=116, maxDocs=43690)\n 0.09296464 = queryNorm\n 0.3785852 = (MATCH) fieldWeight(body:bunni in 327), product of:\n 1.0 = tf(termFreq(body:bunni)=1)\n 6.9227004 = idf(docFreq=116, maxDocs=43690)\n 0.0546875 = fieldNorm(field=body, doc=327)\n 0.2395648 = (MATCH) weight(body:easter^0.7999738 in 327), product of:\n 0.4799619 = queryWeight(body:easter^0.7999738), product of:\n 0.7999738 = boost\n 6.453766 = idf(docFreq=186, maxDocs=43690)\n 0.09296464 = queryNorm\n 0.49913296 = (MATCH) fieldWeight(body:easter in 327), product of:\n 1.4142135 = tf(termFreq(body:easter)=2)\n 6.453766 = idf(docFreq=186, maxDocs=43690)\n 0.0546875 = fieldNorm(field=body, doc=327)\n 0.33333334 = coord(2/6)\n",
"p5zqzz/node/621":"\n0.14027193 = (MATCH) product of:\n 0.42081577 = (MATCH) sum of:\n 0.21124022 = (MATCH) weight(body:bunni^0.8582874 in 328), product of:\n 0.5523649 = queryWeight(body:bunni^0.8582874), product of:\n 0.8582874 = boost\n 6.9227004 = idf(docFreq=116, maxDocs=43690)\n 0.09296464 = queryNorm\n 0.38242877 = (MATCH) fieldWeight(body:bunni in 328), product of:\n 1.4142135 = tf(termFreq(body:bunni)=2)\n 6.9227004 = idf(docFreq=116, maxDocs=43690)\n 0.0390625 = fieldNorm(field=body, doc=328)\n 0.20957555 = (MATCH) weight(body:easter^0.7999738 in 328), product of:\n 0.4799619 = queryWeight(body:easter^0.7999738), product of:\n 0.7999738 = boost\n 6.453766 = idf(docFreq=186, maxDocs=43690)\n 0.09296464 = queryNorm\n 0.4366504 = (MATCH) fieldWeight(body:easter in 328), product of:\n 1.7320508 = tf(termFreq(body:easter)=3)\n 6.453766 = idf(docFreq=186, maxDocs=43690)\n 0.0390625 = fieldNorm(field=body, doc=328)\n 0.33333334 = coord(2/6)\n",
"p5zqzz/node/1204":"\n0.10955032 = (MATCH) product of:\n 0.32865095 = (MATCH) sum of:\n 0.10455858 = (MATCH) weight(body:bunni^0.8582874 in 432), product of:\n 0.5523649 = queryWeight(body:bunni^0.8582874), product of:\n 0.8582874 = boost\n 6.9227004 = idf(docFreq=116, maxDocs=43690)\n 0.09296464 = queryNorm\n 0.1892926 = (MATCH) fieldWeight(body:bunni in 432), product of:\n 1.0 = tf(termFreq(body:bunni)=1)\n 6.9227004 = idf(docFreq=116, maxDocs=43690)\n 0.02734375 = fieldNorm(field=body, doc=432)\n 0.22409238 = (MATCH) weight(body:easter^0.7999738 in 432), product of:\n 0.4799619 = queryWeight(body:easter^0.7999738), product of:\n 0.7999738 = boost\n 6.453766 = idf(docFreq=186, maxDocs=43690)\n 0.09296464 = queryNorm\n 0.46689618 = (MATCH) fieldWeight(body:easter in 432), product of:\n 2.6457512 = tf(termFreq(body:easter)=7)\n 6.453766 = idf(docFreq=186, maxDocs=43690)\n 0.02734375 = fieldNorm(field=body, doc=432)\n 0.33333334 = coord(2/6)\n"},
"filter_queries":["{!tag=sites}sm_sitename:(FCM OR BCM OR CCM)"],
"parsed_filter_queries":["sm_sitename:FCM sm_sitename:BCM sm_sitename:CCM"]}}
這是指示錯誤配置的服務器上,或者是不正確地索引的內容,還是查詢需要改變?
我可以將其用於查詢分析器上的文本字段嗎? – ebeyrent 2012-03-28 21:02:51
查詢解析器不使用標記器或字符過濾器,因此您需要在將格式發送到Solr之前將其格式化。如果它們只是實體,比如' ',那麼編程語言中可能有一個unescape庫函數。 – 2012-03-28 21:06:21
非常感謝您的幫助!我最終在查詢和索引分析器中添加了帶有HTMLStripCharFilterFactory的另一個文本字段,因此我可以對原始未轉義的html進行索引。我的搜索查詢然後在MLT查詢中使用此字段。 – ebeyrent 2012-03-28 22:57:43