I noticed that MATCH AGAINST
cannot search words that have 3 characters or less. So I added LIKE
along with MATCH AGAINST
in one query.
Search query: css and javascript tip
Database entries:
id | subject
------------------------------------
1 | ten useful css tricks
------------------------------------
2 | performance tip for javascript
MySQL query:
3-character words: css, tip
SELECT id, MATCH (subject) AGAINST ('css and javascript tip' IN BOOLEAN MODE)
FROM articles WHERE MATCH (subject) AGAINST ('css and javascript tip')
OR subject LIKE '%css%' OR subject LIKE '%tip%'
This query works fine on my application (with a small database). I'm not sure if it's gonna cause any problems as the database grows.
Is this the correct way to search 3-character words while using MATCH AGAINST? If not, as for the example I provided, how should I seach for css and javascript at the same time?