I have a table of products, e.g. cars. I want users to be able to search using multiple terms, e.g. for autocompletion. LIKE %term% is way to slow, because it's huge table. In order to make it fast, I want to use MySQL's fulltext search. I use ft_min_word_lenght = 1.
Imagine the productname is "Lexus RX450H". Then two words are indexed: "Lexus" and "RX450H".
MATCH (productname) AGAINST ('+lex* +rx45*' IN BOOLEAN MODE) ')
..will match this product, good.
but
MATCH (productname) AGAINST ('+lex* +450*' IN BOOLEAN MODE) ')
wont, because it's imperative to search on begin of words.
Users might know the number, but might forget the letters. I want the second query to match.
If product was: "Lexus RX 450 H", then the last query would have matched, problem solved.
What I could do is create a second column in the table and split all letters/numbers by putting a space in between them, e.g. using regexp. Then, the search should be done on this column, voila, problem solved.
However, the (big) table will become almost twice as big and I was wondering whether it is possible to tell MySQL to perform the indexing like described, without creating an extra column.