Friday, January 08, 2010

MySQL FULLTEXT search and stopwords

If you are trying too look for a word like 'yours' in the TEXT MySQL field you will never get any result. This is because 'yours' is one of the 'stopwords' ignored in the MySQL searches.
Here is the list of all such stopwords


The bad thing is that this behavior does not change even if you search in BOOLEAN mode. This note describes this as a requested fix for some later MySQL release.

Anyway, if you want to search for just ANY word, without taking in consideration the 'stopwords' list of MySQL, add this line

ft_stopword_file=""


in [mysqld] section of your my.cnf file (for XAMPP on Win xamp-folder/mysql/bin/my - no extension)

Next:
a) restart mysql daemon / service
b) rebuild tables indexes, e.g. by the following SQL comand:

REPAIR TABLE `Texts` QUICK

Now you can search for words like "can", "me" and "you" and - what a surprise! - find the records containing them.

No comments: