I’m having troubles understanding the MATCH in MySql. I have a table with Full Text Index on a “keywords”-field. The keywords are comma-separated.
I’m testing with 3 rows, with the keywords: prep,rat,mouse
When I search for either “prep” or “rat”, I get the result I want. But if I search for “mouse”, I get no results. This is the query I’m using:
SELECT *, MATCH(Keywords) AGAINST('mouse') AS Score
FROM fs_Files
WHERE MATCH(Keywords) AGAINST('mouse')
ORDER BY score DESC;
I’ve also tried with IN BOOLEAN MODE after ‘mouse’, but it’s the same result.
EDIT
In my database-entry where I used the word ‘mouse’, I actually used the word ‘mus’ (which is mouse in Norwegian). I found that if I changed this to ‘musebart’ (just made the word longer), the search picks it up. Could it be too short with only 3 chars? Is MySql ignoring it (stopword?) since it only contains 3 chars?
EDIT AGAIN:
Bingo, it has to be at least 4 characters to be searchable. Or else, you have to change it (if you have the permission to do so) Link: http://dev.mysql.com/doc/refman/5.1/en/fulltext-fine-tuning.html.
The
matchworks like thelikeof course with some differences.I mean:
could be too
take a look to Mysql Match: http://dev.mysql.com/doc/refman/5.0/es/fulltext-search.html
Take a look the difference between them (match and like): Mysql match…against vs. simple like "%term%"