///MySQL fulltext search for 3 char words

MySQL fulltext search for 3 char words

If you are familiar with full text searching in MySQL, you will be surprised to know that MySQL doesn’t index words containing 3 or less characters by default. Searching such words ends up with no result. I am sure sometime you also suffered from the same problem. If you are not familiar with this default behavior of MySQL you may spend hours after hours trying to find out what went wrong. Well, here is the solution for you :D

There is a system option named “ft_min_word_len” by which you can define the minimum length of words to be indexed. You need to set value to this configuration directive in your MySQL configuration file which is found under “/etc/mysql” or “/etc”. In windows you can look under windows directory or MySQL home folder. You need to set this value under [mysqld] section.

[mysqld]
ft_min_word_len=3

There is also a handy method if you don’t want to change in your configuration file. Just start your mysql daemon with the following command

mysqld --ft_min_word_len=3

You may also need to rebuild your index.

Now you can search words with 3 characters in your full text queries.

2010-05-25T22:31:13+00:00 February 13th, 2008|MySQL|0 Comments

About the Author:

Leave A Comment