Mysql full text search not working for 3 characters

On my website, I implemented a search function using full-text search.

It works fine fine, but sometimes it fails when I search for the keyword "ship" but not "shi"

But he must return. Please help me why this is happening.

+6
source share
1 answer

The minimum and maximum lengths of words to be indexed are determined by the system variables ft_min_word_len and ft_max_word_len . The minimum default value is 4 . This is why it does not work with characters 3 .

You need to change its value and rebuild the FULLTEXT indices. If you want the 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 superuser privileges, you can set this environment variable with:

  SET ft_min_word_len=3 

Get more information here: Fine-tuning MySQL full-text search

+8
source

Source: https://habr.com/ru/post/912172/


All Articles