2

显然,如果 Mysql 表的全文索引包含出现在 50% 的数据行中的关键字,则匹配查询将忽略该关键字

因此,如果我有一个全文索引“内容”的表,其中包含 50 个条目,其中 27 个条目在内容字段中包含“计算机”一词,然后我运行查询:

SELECT * 
  FROM `table` 
 WHERE MATCH(`content`) AGAINST ('computer'); 

...计算机查询将返回零结果,因为计算机出现在超过 50% 的条目中,因此关键字被忽略...

有没有办法禁用此功能,特别是因为这在数据库生命周期的开始阶段是有问题的

4

2 回答 2

2

Use BOOLEAN full-text searches to bypass 50% feature.

http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html

于 2010-07-19T18:11:45.230 回答
0

Yes, use the Boolean Full-Text Searched option

See here Mysql Manual

The manual says that "They do not use the 50% threshold."

The search in MySQL is not intuitive and the manual is slightly confusing so you need to read it carefully as well as preparing some test cases to make sure it is working and that you have implemented it correctly (from bitter experience).

There are a number of other search plugin's of varying complexity that you might want to look at that perform better but it is worth getting to grips with the native version as it is quick and (easy?) dirty.

于 2010-07-19T18:12:40.843 回答