开发者

how to disable mysql's match query's 50% exclusion

So apparently if a Mysql table's fulltext index contains a keyword that appears in 50% of the data rows, that keyword will be ignored by the match query

So if I have a table with the fulltext ind开发者_如何学Goex 'content' which contains 50 entries and 27 of the entries contains the word 'computer' in the content field, and I run the query:

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

...the computer query will return zero results since computer appears in more than 50% of the entries and hence the keyword is ignored...

is there a way to disable this functionality especially since this is problematic in the beginning phase of the database's lifespan


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

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜