如果有人以前使用过Sphinx搜索引擎...你知道它是否可以连接单词吗?
当您搜索“Stack Overflow”时,Sphinx 不会显示与“Stackoverflow”匹配的结果,
这是因为 Sphinx 将“Stackoverflow”索引为一个单词……而查询是两个单词。
有谁知道如何解决这个问题? (像谷歌一样……他们可以加入查询!)
When you search "Stack Overflow", Sphinx will not bring up results that match "Stackoverflow"
That's because Sphinx indexes "Stackoverflow" as one word...whereas the query is two words.
Does anyone know how to fix this? (like Google...they can join the query !)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用词形功能将单词映射到不同的单词,或者将多个单词匹配到一个单词。如果你有很多单词想要纠正,你可以这样做。我认为如果您使用此功能,您只需执行一次搜索,并且可能比执行“或”搜索更快。
You can use the wordforms feature to map words to different words, or to match many words to a single word. If you have a lot of words you want to correct, you could do this. I think if you used this feature you would only have to do a single search, and it would probably be faster than doing an "or" search.
无需篡改提供给 Sphinx 的数据。您需要做的就是稍微修改表单处理代码中对Sphinx的搜索请求,使其包含搜索词的各种组合并使用SPH_MATCH_EXTENDED匹配模式。特别是,对于你的例子
There's no need to tamper with data being fed to Sphinx. All you need to do is to slightly modify the search request to Sphinx in your form processing code so that it contained various combinations of search terms and use SPH_MATCH_EXTENDED matching mode. In particular, for your example
难道你不能将搜索词组合成一个词,然后再发送给 sphinx 吗?您需要对搜索词进行所有排列,即
my search term
为mysearch
、mysearchterm
和searchterm
,但这似乎可行。Couldn't you just combine the search terms into one words before sending them to sphinx? You would need to do all permuations of serach terms, ie
my search term
asmysearch
,mysearchterm
, andsearchterm
, but that seems like it would work.