user1296109
user1296109

Reputation:

mysql full-text search not working for 3 characters

In my website I have implemented search feature using full-text search.

It works fine usually but not sometimes like it gives results when I search with keyword "ship" but not "shi"

But it should return. Please help me why this happening.

Upvotes: 7

Views: 4615

Answers (1)

user319198
user319198

Reputation:

The minimum and maximum lengths of words to be indexed are defined by the ft_min_word_len and ft_max_word_len system variables. The default minimum value is 4 characters. That is why it's not working with 3 characters.

You need to change its value, and rebuild your FULLTEXT indexes. If you want three-character words to be searchable, you can set the ft_min_word_len variable by changing its value in the configuration file. Or, if you have super user permissions you can set this environment variable with:

  SET  ft_min_word_len=3

Get more details here: Fine-Tuning MySQL Full-Text Search

Upvotes: 9

Related Questions