I am trying to understand the MySQL fulltext search function (MATCH) and I do not understand why I get the records that does not “match” the search phrase.
SELECT name FROM song WHERE (MATCH(name) AGAINST('*Spending my*' IN BOOLEAN MODE)) ORDER BY name ASC;
When I execute this query it returns me a lot of (259 records) that does not even match the search phrase, like:
+---------------------------------------------------------+
| name |
+---------------------------------------------------------+
| All By Myself |
| All By Myself - simple version |
| Over My Head (Cable Car) |
| Rest of My Life |
| Spending My Time |
+---------------------------------------------------------+
So, it returns a lot of records, but as it is shown, the search “phrase” is not match for 99.9% of records, and also the “correct” song name is returned.
Why this is happening? I use Boolean mode because of wildcard search, I want to use it like fulltext and need to achieve:
- Find the song name if I put full name
- Find the song if I put the part of the song (like in my query)
- Do not want to get records that does not match the search phrase
What I am doing wrong here?
Thank you!