MySQL full-text stopwords problem

故事扮演 提交于 2019-12-07 10:51:42

问题


I have a database named "products" and a FULLTEXT index with the columns: title and description. All of my products are lubrifiants (oils), and there are two types of it: industrials and aut-moto, with a rate of 55%-45%. If I make a search after auto-moto oils then it will return no results because the "auto-moto" keyword is present in more then half of the rows, and the oils in all of them, so the MySQL puts them into the STOPWORDS list.

I am using PHP. How can I make that query to give back the right results?


回答1:


The answer is IN BOOLEAN MODE . If you use boolean mode then the mysql will ignore that the key is present in more then 50% of the rows. In the same time it has a very strong and useful ability: AGAINST ('*key*').




回答2:


Could it be because auto-moto contains a "-" character which according to http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html performs a NOT search, so all rows with "auto" but NOT "moto"

try searching for "auto moto"

also could you post the actual SQL you are using, might help in diagnosing the problem



来源:https://stackoverflow.com/questions/4449431/mysql-full-text-stopwords-problem

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