MySQL fulltext search not working for some words like 'house'

喜夏-厌秋 提交于 2020-01-02 05:27:09

问题


I've setup a full text index on a small selection of records across 3 fields (tried a combination of the 3 as well and had the same result), and some words return results fine, but certain ones such as 'house' and 'australia' don't (interestingly, 'australian' and 'home' do).

It seems like odd behaviour. If I add "WITH QUERY EXPANSION" I get results, but they aren't the most relevant now.

Anyone got any idea why this is? Otherwise I'm going to have to resort to using LIKE searches, and I'd prefer to have relevancy included.


回答1:


It could be a couple of things:

  • MySQL has a default list of 'stop words' that aren't included in a full text search - http://dev.mysql.com/doc/refman/5.5/en/fulltext-stopwords.html . 'house' and 'australia' don't seem to be in that list, but other words you search for might be affected by it.
  • Any word that appears in over 50% of the rows or is 3 letters or in less in length in the database is also considered a stop word. The 50% thing is particularly easy to be caught out by if you're just testing the full text search out on a table with only a few rows in.

If you search Google for "mysql stop words" you'll find a lot more about it, as it's one of those things that catches a lot of people out.



来源:https://stackoverflow.com/questions/4612787/mysql-fulltext-search-not-working-for-some-words-like-house

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