问题
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