I have a search engine. I have to select some data from a table when a user types in the search keywords.
I want to find an alternative to ‘LIKE’:
SELECT id,text FROM example WHERE text LIKE '$search'
Because the text column has usually loads of words in it and the search term always contains a few words, I don’t get accurate results.
Is there any other way of doing this?
It’s called full-text indexing, but currently it’s not supported in InnoDB, only in MyISAM. Alternative is to use third-party indexing, like Lucene, Solr (which provides web service access on top on Lucene), Sphinx…