I’m using a MySQL database.
I have a products database where users can search for, basically, any products they want to buy.
I’m having problems with a boolean search because if a user searches for ‘new ipad’ or ‘ipad 4g’ I want to return the most relevant results first, but, the results I am returning are inaccurate as the fulltext index only indexes words over 4 characters in length.
Is there a way around this? If I change the ft_min_word_len variable to be 2 characters instead of 4 and then re-index, is that a massive performance hit?
You can decrease
ft_min_word_lenbut it will affect not only that table, but all tables in all the MySQL databases on that server.Your second option is a fulltext search engine like Sphinx, which might have an option for that.
And your third option, is to change your search query based on the search term. At program side you detect whether the text is smaller than
ft_min_word_len. If it is, you run a query withLIKE /% %/; otherwise, use fulltext search.