I'm working on a simple MySQL full-text search feature on a CakePHP site, and noticed that MySQL strips short words (3 chars or less) out of the query. Some of the items in the site have 3 character titles, however, and I'd like to include them in the results. (I've ruled out using more robust search appliances like Solr due to budget constraints)
So I want to find any 3 character words in the query string, and do a quick lookup just on the title field. The easiest way I can think to do this is to explode()
the string and iterate over the resulting array with strlen()
to find words of 3 characters. Then I'll take those words and do a LIKE
search on the title field, just to make sure nothing that should obviously be in the results was missed.
Is there a better / easier way to approach this?
UPDATE: Yes, I know about the ft_min_word_len
setting in MySQL. I don't think I want to do this.