开发者

Why might a full-text search not return short words even if ft_min_word_len has been lowered?

开发者 https://www.devze.com 2023-04-08 21:11 出处:网络
In my MySQL configuration I\'ve set ft_min_word_len = 2 and rebuilt the index with a quick repair. Is there anything else I need to do in order to be able to search for short (3 letter) words?

In my MySQL configuration I've set ft_min_word_len = 2 and rebuilt the index with a quick repair.

Is there anything else I need to do in order to be able to search for short (3 letter) words?


EDIT: This query

    SELECT *, match(`Tournament`.`Name`) against ('aaa') as score, `Tournament`.`id` FROM `tournie`.`tournaments` AS `Tournament` WHERE 1 = 1 GROUP BY 开发者_StackOverflow`Tournament`.`id` having score > 0.1 ORDER BY `score` desc LIMIT 20

returns 0 records despite the existence of a record with that exact name - "aaa". I've also tried others, such as "bag" and (a classic) "bum".


Did you also restart mysql after making the change? You need to restart and rebuild your indexes. Also remember that if what you are searching on appears in more than 50% of the records, mysql won't return anything. This makes testing with 10 records difficult.


Please make sure that you added ft_min_word_len = 2 in

1 #Vi etc/my.cnf

[mysqld]

ft_min_word_len = 2

after that

#service mysqld restart
#rebuild your index
0

精彩评论

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

关注公众号