Like when the user writes the article title in the input field, I want to search existing articles to see if there are similar ones.
For eg.
SQL search query like stackoverflow
I want to find the most relevant articles related to this title.
I know it’s something like:
WHERE article_title LIKE 'word'
but how do I handle multiple keywords?
Use a fulltext index, which’d be something like:
Or hack up the query to look like
Of the two, the fulltext version will be faster, as it can use an index. The ‘
LIKE %...%version will be very expensive, as wildcard search of that sort cannot use indexes at all. The downside is that fulltext indexes are only available on MyISAM tables, and will probably never be available for InnoDB tables.