I’m doing a pretty standard MySQL MATCH(...) AGAINST(...) query. I’m returning the score of each row as column score. The problem here is that score can be more than 1, so getting a percentage is tricky (multiplying by 100) due to the fact I can get scores greater than 1. My question is, can I normalise the score column so I get all scores from 0 to 1, but keep them in proportion (for example, a score of 4 would be 1, and a score of 2 would become 0.5, etc, but 4 can be a dynamic upper bound).
My query is as follows:
SELECT *, MATCH(body) AGAINST ('string') AS score
FROM home_posts
WHERE MATCH(body) AGAINST ('string')
The score in a MySQL
MATCHis not a percentage and trying to convert it to such would be the completely wrong approach altogether. You can read the math behind it at http://forge.mysql.com/wiki/MySQL_Internals_Algorithms#Full-text_SearchEDIT:
I would try