views:

418

answers:

1

I'm trying to get my full text search (in boolean mode) to retrieve words with three letters or less.

Currently, if I search for something like "NBA", I don't get any results.

However, if I append the wild card operator "*" to the search term, I get results.

I also read that you could remove the three word limit in my.ini, but I'm wondering if there was a better way to do this on the fly.

+1  A: 

This section of the manual might interest you : 11.8.6. Fine-Tuning MySQL Full-Text Search (quoting a portion of it) :

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 four characters; the default maximum is version dependent. If you change either value, you must rebuild your FULLTEXT indexes.
For example, if you want three-character words to be searchable, you can set the ft_min_word_len variable by putting the following lines in an option file:

[mysqld]
ft_min_word_len=3

Then you must restart the server and rebuild your FULLTEXT indexes.

(You should read that page, for more informations I didn't copy-paste ;-) )

Pascal MARTIN
Thanks Pascal, I read the same already, the idea I have is to do it with a PHP function that checks the length of the search phrase and appends the wildcard * modifier if it is less than ft_min_word_lenwondering if there is a better way to go about it than that...
Digital Craft Studios
Oh, sorry, didn't understand that ;; I don't have much of an idea about that... not sure it would be good performance wise, though ;; just as a sidenote : what about using some external indexing/searching engine, like solr or sphinx ?
Pascal MARTIN
thanks, I've heard of sphinx but haven't had the time to wrap my head around it yet, will look into it soon
Digital Craft Studios