在 Solr 中建立索引时使用尾随 '
我正在尝试使用 Solr 实现一种合理的搜索方式,但我陷入了一个特定的位置,我正在索引一堆公司名称。可以说其中之一是Lowe's。现在,当有人输入 lowes 时,我希望显示结果,但我无法使此功能正常工作。有谁知道如何让它工作?
I am trying to implement a sane way to search using Solr, but I am getting stuck at a particular place, I am indexing a bunch of company names. Lets say one of them is Lowe's. Now when someone types lowes, I want a result to show up, but I am unable to get this functionality working. Does anyone know how to get this working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题是,如果您设法将分析器配置为以一种方式执行此操作(即搜索
lowes
并匹配Lowe's
),您很可能会破坏另一种方式(即,搜索lowe's
并获取Lowe's
)。一种不需要模式黑魔法的快速解决方法是 模糊搜索< /a>.尝试搜索
lowes~
。The problem is, if you manage to configure your analyzers to do it one way (i.e., searching
lowes
and matchingLowe's
), you'll most probably break the other way (i.e., searchinglowe's
and gettingLowe's
).One quick workaround that doesn't need black magic with your schema is fuzzy searching. Try searching for
lowes~
.一种可能的解决方案是将它们添加到同义词文本文件。另外, WordDelimiterFilterFactory 提到了一种通过删除尾随 来处理尾随 的方法。但这可能不是您想要的。
One possible solution might be to add them to the synonym text files. Also, the WordDelimiterFilterFactory mentions a way to treat trailing 's by removing them. But that is probably not what you want.