Solr - 如果在特殊字段中找到查询则提升结果
我想知道如果在特殊字段中找到查询而不使用“fieldname:query”语法,Solr 3.4 是否可以提高搜索结果。
让我解释一下:
我的索引中有几个字段。其中一个名为“缩写”,并填充了诸如 AVZ、JSP、DECT 等文本。
为了能够在纯粹搜索“AVZ”时找到结果,我
<copyField source="abbreviation" dest="text"/>
在 schema.xml 中添加了一个。字段文本是我的默认搜索字段。
我认为这不是最好的解决方案。所以我试图找出,是否可以在所有字段中搜索“AVZ”,并且如果在字段缩写中找到该字符串,则应提高结果条目(增加分数),以便将其列在结果列表中的第一个条目。与使用缩写:AVZ AVZ 作为查询相同。
我能想到的另一种可能性是分析查询。如果找到像“AVZ”这样的子字符串,查询将附加缩写:AVZ。但在这种情况下,我必须能够找出哪些缩写被索引。是否可以使用 SolrJ 从 Solr 索引中检索字段的所有可能术语?
此致 托比亚斯
I am wondering if it is possible with Solr 3.4 to boost a search result, if the query is found in a special field without using the "fieldname:query"-syntax.
Let me explain:
I have several fields in my index. One of it is named "abbreviation" and is filled with text like AVZ, JSP, DECT, ...
To be able to find results when searching purely for "AVZ" I added a
<copyField source="abbreviation" dest="text"/>
in my schema.xml. The field text is my defaultSearchField.
This is not the best solution in my opinion. So I am trying to find out, if it is possible to search for "AVZ" in all fields and if the String is found in the field abbreviation, the result entry should be boosted (increasing the score) so that it will be listed at first entry in the result list. Would be the same as using abbreviation:AVZ AVZ as query.
The other possibility I can think of is to analyze the query. And if a substring like "AVZ" is found, the query will be appended with abbreviation:AVZ. But in this case I must be able to find out, which abbreviations are indexed. Is it possible to retrieve all possible terms of a field from the Solr index using SolrJ?
Best Regards
Tobias
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果没有 fieldname:term 语法,可以使用定义请求处理程序 -
这使用 dismax 查询解析器。您也可以使用 edismax。
这将提高结果,并且查询将是一个简单的查询,如 q=AVZ。
如果仅通过网址,您可以增强特定字段的匹配,如提到的@ 链接
例如,
这将通过缩写匹配来提高结果,这将导致文档出现在 顶部。
使用
*:*
查询不可能获得 dismax 的所有结果。但是,对于所有文档,不要传递任何 q 参数。
q.alt=*:*
将返回所有文档。否则,将
defType
更新为edismax
。Without the fieldname:term syntax use can define a request handler -
This uses the dismax query parser. You can use edismax as well.
This will boost the results and query would be a simple query as q=AVZ.
If only through url, you can boost match on specific field like mentioned @ link
e.g.
This would boost the results with a match on abbreviation, which would result the documents to appear on top.
It is not possible to get all results with dismax using the
*:*
query.However, for all docs just do not pass any q param.
q.alt=*:*
will return all the docs.Else, update the
defType
toedismax
.Apache Solr 6.4.2:
增强精确短语搜索不起作用:
Solrconfig.xml:
明确的
用于测试的 Solr 查询:
q=(names:alex%20pandian)&wt=json&debugQuery=on
在调试模式下显示
它仅从第二个单词增强术语。在这种情况下,只有 Pandian 得到提升,但 Alex 没有。
Apache Solr 6.4.2:
Boosting Exact phrase search not working:
Solrconfig.xml:
explicit
Solr query used to test:
q=(names:alex%20pandian)&wt=json&debugQuery=on
In debug mode it shows
It is boosting the terms from second word only. In this case only Pandian is boosted but Alex is not.