mysql failed fulltext search with a particular word

I'm in trouble with a strange behavior of mysql. If I try to search with fulltext query sam* word, I have no results back.

Ex. table companies


    id || name
    1  || Company name
    2  || Same Company name

If I make

`SELECT name FROM companies WHERE MATCH name AGAINST ('+Company*' IN BOOLEAN MODE)`

It works, instead if I use

`SELECT name FROM companies WHERE MATCH name AGAINST ('+Sam*' IN BOOLEAN MODE)`

or

`SELECT name FROM companies WHERE MATCH name AGAINST ('+Same' IN BOOLEAN MODE)`

I have no results!

Do you have any idea about this issue?

PS. if I use +Sa* instead of +Sam*, it works


You must to change the configuration value ft_min_word_len (fulltext min word length) the default value is set to 4.

Add (or modify) this line to mysql config /etc/my.cnf (or my.ini in windows)

ft_min_word_len = 3

After that you may call the index re-creation using the command:

REPAIR TABLE companies QUICK;

BTW: Fulltext search doesn't accept LIKE wildcards: * or %

链接地址: http://www.djcxy.com/p/75324.html

上一篇: 使用!=和ANY

下一篇: MySQL无法用特定的单词进行全文搜索