How can I do a MySQL search which will match partial words but also provide accurate relevancy sorting?
SELECT name, MATCH(name) AGAINST (\'math*\' IN BOOLEA
I obtained a good solution in this (somewhat) duplicate question a year later:
MySQL - How to get search results with accurate relevance
The new InnoDB full-text search feature in MySQL 5.6 helps in this case. I use the following query:
SELECT MATCH(column) AGAINST('(word1* word2*) ("word1 word1")' IN BOOLEAN MODE) score, id, column
FROM table
having score>0
ORDER BY score
DESC limit 10;
where ( )
groups words into a subexpression. The first group has like word%
meaning; the second looks for exact phrase. The score is returned as float.