SOLR 中的子字符串匹配
我似乎无法弄清楚如何使用 SOLR 查找子字符串匹配,我已经根据前缀找出了匹配,这样我就可以让火腿与汉堡包匹配。
我如何搜索“汉堡”来匹配汉堡包?我尝试了汉堡,但这抛出了错误“*”或“?”不允许作为 WildcardQuery 中的第一个字符。
如何使用 SOLR 匹配子字符串?
I can't seem to figure out how to find substring matches with SOLR, I've figured out matches based on a prefix so I can get ham to match hamburger.
How would I get a search for 'burger' to match hamburger as well? I tried burger but this tossed an error '*' or '?' not allowed as first character in WildcardQuery.
How can I match substrings using SOLR?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果有人在搜索“apachesolr substring”后最终来到这里,有一个更简单的解决方案:https://drupal.stackexchange。 com/a/27956/10419(来自 https://drupal.stackexchange.com/questions/26024/how-can-i-make-search-with-a-substring-of-a-word)
If anyone ends up here after searching for "apachesolr substring", there's a simpler solution for this : https://drupal.stackexchange.com/a/27956/10419 (from https://drupal.stackexchange.com/questions/26024/how-can-i-make-search-with-a-substring-of-a-word)
您可以启用此功能,但它会非常消耗资源(例如搜索 SuffixQuery)。
请参阅:http://lucene.472066.n3.nabble。 com/Leading-Wildcard-Search-td522362.html
引用邮件列表:
解决方法?想象一下使用所有术语向后拼写的第二个索引(或添加另一个字段)。
=>
请参阅添加 ReverseStringFilter https://issues.apache.org/jira/browse/LUCENE-1398
并支持高效的前导通配符搜索:https://issues.apache。 org/jira/browse/SOLR-1321
目前 issues.apache.org 似乎已关闭。尝试使用例如谷歌缓存。
You can enable this but it will be very resource hungry (e.g. search for SuffixQuery).
See: http://lucene.472066.n3.nabble.com/Leading-Wildcard-Search-td522362.html
Quoting the mailing list:
Work arounds? Imagine making a second index (or adding another field) with all of the terms spelled backwards.
=>
See Add ReverseStringFilter https://issues.apache.org/jira/browse/LUCENE-1398
and Support for efficient leading wildcards search: https://issues.apache.org/jira/browse/SOLR-1321
At the moment issues.apache.org seems down. Try to use e.g. google cache.
如链接中所述,您可以使用使用 edismax (ExtendedDismaxQParser) 引导通配符。只要尝试一下,看看它是否足够快。
有关上述反向字符串的更多信息也可以在这里找到: solr.ReversedWildcardFilterFactory
As stated before in link you can use leading wildcards with edismax (ExtendedDismaxQParser). Just try it out to see if it is fast enough.
Some more info about the above mentioned reversedstring can also be found here: solr.ReversedWildcardFilterFactory