Rank SQL full text query by relevance in boolean mode

Assuming that $keywords holds the query keywords, a table containing the indexed columns title and body may be queried for relevant results using:

SELECT mytable.*, MATCH(title,body) 
AGAINST('$keywords') AS relevance 
FROM `mytable` 
WHERE MATCH(title,body) AGAINST('$keywords' IN BOOLEAN MODE) 
ORDER BY relevance DESC

Let’s keep in touch

Get noise-free updates on software, product, and process.

Hey, I'm RJ: digital entomologist and intermittent micropoet, writing from the beautiful Rose City.