Search Solr搜索相关性提升和bf权重不适用于内容^1
我需要微调搜索相关性和权重,因为返回的结果是:Search Solr搜索相关性提升和bf权重不适用于内容^1,search,solr,lucene,Search,Solr,Lucene,我需要微调搜索相关性和权重,因为返回的结果是: 与搜索无关 标题搜索不会将匹配的列表返回到顶部 Solr配置请求处理程序的代码段: <requestHandler name="/select" class="solr.SearchHandler"> <lst name="defaults"> <str name="defType">edismax</str> <str name="echoParams">explicit&l
- 与搜索无关
- 标题搜索不会将匹配的列表返回到顶部
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="defType">edismax</str>
<str name="echoParams">explicit</str>
<int name="rows">10</int>
<str name="df">text</str>
<str name="q.alt">*:*</str>
<str name="q.op">AND</str>
<str name="qf">title^15.0 description^9.0 categoryNames^3.0 authorName^1.0 content^1.0</str>
<str name="boost">scoreA</str>
</lst>
<lst name="appends">
<str name="fq">private:false</str>
<str name="fq">deleted:false</str>
<str name="fq">draft:false</str>
</lst>
此字段类型已应用此筛选器:
<filter class="solr.PorterStemFilterFactory"/>
“完整”字中省略了“e”
以下是solr中当“content^1”在qf中时的响应片段:
"responseHeader": {
"status": 0,
"QTime": 187,
"params": {
"lowercaseOperators": "true",
"spellcheck": "true",
"facet": "true",
"sort": "scoreA desc",
"indent": "true",
"qf": "title^15.0 description^9.0 categoryNames^3.0 authorName^1.0 content^1",
"spellcheck.collate": "true",
"wt": [
"json",
"javabin"
],
"hl": "true",
"version": "2",
"defType": "edismax",
"rows": "18",
"fl": "id,url,price,title,description,recommended,modifiedDate,downloadCount:field(downloadCount),ratingAverage:field(ratingAverage),ratingCount:field(ratingCount),scoreA:field(scoreA),scoreB:field(scoreB),viewCount:field(viewCount),authorName,authorId,content,categoryNames,score",
"start": "0",
"q": "world wars",
"q.op": "AND",
"_": "1429801074587",
"facet.field": [
"categories",
"categoryRoot",
"resourceTypes",
"fileTypes",
"recommended",
"licence"
],
"stopwords": "true"
}
进一步调查结果:
"responseHeader": {
"status": 0,
"QTime": 187,
"params": {
"lowercaseOperators": "true",
"spellcheck": "true",
"facet": "true",
"sort": "scoreA desc",
"indent": "true",
"qf": "title^15.0 description^9.0 categoryNames^3.0 authorName^1.0 content^1",
"spellcheck.collate": "true",
"wt": [
"json",
"javabin"
],
"hl": "true",
"version": "2",
"defType": "edismax",
"rows": "18",
"fl": "id,url,price,title,description,recommended,modifiedDate,downloadCount:field(downloadCount),ratingAverage:field(ratingAverage),ratingCount:field(ratingCount),scoreA:field(scoreA),scoreB:field(scoreB),viewCount:field(viewCount),authorName,authorId,content,categoryNames,score",
"start": "0",
"q": "world wars",
"q.op": "AND",
"_": "1429801074587",
"facet.field": [
"categories",
"categoryRoot",
"resourceTypes",
"fileTypes",
"recommended",
"licence"
],
"stopwords": "true"
}
使用查询“world war”进行搜索时,“war”一词的权重很大,因为它在前几个列表附件中被多次找到。如果把“战争”这个词单独作为一个词或作为另一个词的一部分来发现,那么分数似乎会提高。例如,“战争”和“小心”
当“战争”作为一个整体被发现时,我只需要提高内容分数,如果在其他词中发现,我不会做任何事情。希望这是有道理的
这个问题的最终解决方案是使用sort=score-desc&boost=scoreA
而不是sort=score-desc&boost=scoreA
。这将使用scoreA
的提升值作为Solr得分的乘数,然后使用得分进行排序,其中考虑了Solr自身的相关性数学和提升值。下面是原始答案和导致这一结论的对话
听起来您对其他字段的相对权重很满意,但即使权重较低,内容与其他字段相比也太相关了
最可能的解决方案是调整权重,或者降低内容的权重,或者提高其他字段的权重。也许content^0.1
会给你想要的结果。如果包含内容字段的唯一目的是在更重要的位置找不到匹配项时在那里查找匹配项,那么设置极低的相对权重将确保“内容”匹配项永远不会超过其他字段中的匹配项
总的来说,我发现它是调试Solr相关性的有用工具。它从test Solr查询中获取查询结果,您在该查询中激活了可选的相关性解释输出,并为您提供了如何为每个结果文档确定相关性的图形表示。它不能很好地处理具有自己的逻辑运算符的复杂查询,但是对于一个简单的测试查询,它可以极大地帮助您理解关联顺序是如何确定的,以便您可以适当地调整它
编辑:现在您已经添加了响应片段,我注意到您正在使用q.op=和
,但这是。因为您使用的是,所以应该改用mm
()参数mm=100%
相当于Dismax和扩展Dismax查询解析器的q.op=和
。我不知道这是否与您遇到的问题有关,但可能与此有关。为什么需要此权重?如果除了我的搜索查询中附件“内容”中的某些内容之外,没有其他匹配项(标题、描述等),则应在搜索中返回较高的权重。当您谈论删除内容^1
权重时,您的意思是将内容
字段完全从qf
中删除,还是仅删除^1
?当你说它在没有权重的情况下“完美工作”,但“一切都出了问题”时,你可能还想添加更多关于你的意思的细节。出了什么问题?您是否收到错误消息,或者您的关联顺序工作不正常?内容字段完全超出了qf。当我说WorksPerfect时,我的意思是搜索相关性和标题搜索顺序是正确的,没有qf中的内容字段。如果是在qf中,关联顺序就偏离了标准。在顶部返回不相关的结果。我尝试了不同的权重,但仍然无法解决问题。我尝试使用标题^150.0 description ^90.0 categoryNames ^30.0 authorName ^1.0 content ^0.1,但仍然得到相同的结果。结果只有在内容从qf中删除时才会更改。您是否尝试查看“解释”数据?查看哪些字段对每个结果的分数有贡献以及贡献多少确实很有帮助。我只是根据您添加到问题中的响应片段在我的答案中添加了一点。如何获得完整的原始solr响应?我通常通过直接在浏览器中形成查询来获得原始solr响应。我想你就是这样被剪掉的。您还可以通过添加的参数debugQuery=true
获取其他调试信息。
<filter class="solr.PorterStemFilterFactory"/>
first world war complet unit
"responseHeader": {
"status": 0,
"QTime": 187,
"params": {
"lowercaseOperators": "true",
"spellcheck": "true",
"facet": "true",
"sort": "scoreA desc",
"indent": "true",
"qf": "title^15.0 description^9.0 categoryNames^3.0 authorName^1.0 content^1",
"spellcheck.collate": "true",
"wt": [
"json",
"javabin"
],
"hl": "true",
"version": "2",
"defType": "edismax",
"rows": "18",
"fl": "id,url,price,title,description,recommended,modifiedDate,downloadCount:field(downloadCount),ratingAverage:field(ratingAverage),ratingCount:field(ratingCount),scoreA:field(scoreA),scoreB:field(scoreB),viewCount:field(viewCount),authorName,authorId,content,categoryNames,score",
"start": "0",
"q": "world wars",
"q.op": "AND",
"_": "1429801074587",
"facet.field": [
"categories",
"categoryRoot",
"resourceTypes",
"fileTypes",
"recommended",
"licence"
],
"stopwords": "true"
}