Sphinx returning bad search results

主宰稳场 提交于 2019-12-05 10:02:00

Unless you have enable_star set to 1 and min_prefix_len or min_infix_len set to 1 or more, you won't get B to match Baltimore (and even then, I think you need to search for B* to get the match).

What's happening here is that by default, Thinking Sphinx tells Sphinx to use an English stemmer, which allows for similar words (by characters, not by meaning) to be considered matches, so it puts Baltimor and Baltimore in the same basket.

If you want to get any part of any word matched, then you need to put something like the following in config/sphinx.yml:

development:
  enable_star: 1
  min_infix_len: 1
test:
  enable_star: 1
  min_infix_len: 1
production
  enable_star: 1
  min_infix_len: 1

Then stop Sphinx, re-index, and restart Sphinx. Once you've done that, then searches for B* should return Baltimore.

Hope this helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!