我的solr索引中存有一些视频标题。我根据标题查询,但想要评分来影响分数。该评级是典型的5星评级。此评级与视频一起存储在solr中。我尝试使用dismax请求处理程序,但看起来solr没有提升值。
您可以在下面看到我的requestHandler:
<requestHandler default="true" name="dismax" class="solr.SearchHandler" >
<lst name="dismax">
<str name="defType">dismax</str>
<str name="echoParams">explicit</str>
<float name="tie">0.01</float>
<str name="qf">
title
</str>
<str name="pf">
title
</str>
<str name="mm">
0
</str>
<str name="bq">
rating:1^1.0 rating:2^1.0 rating:3^3.0 rating:4^5.0 rating:5^10.0
</str>
<str name="fl">
*,score
</str>
<int name="ps">100</int>
<str name="q.alt">*:*</str>
</lst>
希望有人可以帮助我!
我使用debug运行查询,这是调试的输出。在计算得分时看不到评分字段......
4.429465 = (MATCH) weight(title:test in 1894), product of:
0.99999994 = queryWeight(title:test),产品:4.4294653 = idf(docFreq = 26876,maxDocs = 829428)0.22576088 = queryNorm 4.4294653 = (MATCH)fieldWeight(标题:1894年测试),产品:1.0 = tf(termFreq(title:test)= 1)4.4294653 = idf(docFreq = 26876, maxDocs = 829428)1.0 = fieldNorm(field = title,doc = 1894)
更多调试信息:
<lst name="debug">
<str name="rawquerystring">test</str>
<str name="querystring">test</str>
<str name="parsedquery">title:test</str>
<str name="parsedquery_toString">title:test</str>
<lst name="explain">...</lst>
<str name="QParser">LuceneQParser</str>
<arr name="filter_queries">
<str/>
</arr>
<arr name="parsed_filter_queries"/>
<lst name="timing">...</lst>
</lst>
答案 0 :(得分:2)
似乎您已将列表定义为dismax而非默认值 -
<requestHandler name="dismax" class="solr.SearchHandler" >
<lst name="defaults">
<str name="defType">dismax</str>
<str name="echoParams">explicit</str>
<float name="tie">0.01</float>
<str name="qf">
title
</str>
<str name="pf">
title
</str>
<str name="mm">
0
</str>
<str name="bq">
rating:1^1.0 rating:2^1.0 rating:3^3.0 rating:4^5.0 rating:5^10.0
</str>
<str name="fl">
*,score
</str>
<int name="ps">100</int>
<str name="q.alt">*:*</str>
</lst>
</requestHandler>
对我来说很好 -
<str name="parsedquery">(+DisjunctionMaxQuery((title:itunes)~0.01) DisjunctionMaxQuery((title:itunes)~0.01) rating:1 rating:2 rating:3^3.0 rating:4^5.0 rating:5^10.0)/no_coord</str>