I have a MySQL table with a ‘tags’ field, which is using a FULLTEXT index. This field contains a list of comma separated values i.e ‘books, toys, chocolate coloured sofa’.
SELECT * FROM Store WHERE MATCH(Store.tags) AGAINST ('"chocolate"' IN BOOLEAN MODE);
The (above) example query is matching records containing ‘chocolate coloured sofa’. I would only like to retrieve records which contain ‘chocolate’ within the delimiters (in this case commas). In other words I would expect that the example record would fail the match.
I have looked at the MySQL manual including MySQL Fine-Tuning MySQL Full-Text Search but I cannot see any way this could be achieved.
Any pointers would be appreciated.
If the last tag has comma, you can search adding the comma:
But be careful with tags less than 4 characters, its aren’t matched… well, you can configure it in my.ini