SyntaxStudy
Sign Up
MySQL Intermediate 4 min read

Relevance Ranking

Relevance Ranking

The relevance score is based on TF-IDF: higher scores for rare words and words appearing in fewer rows. Use ORDER BY score DESC for ranked results.

Example
SELECT
  title,
  MATCH(title, body) AGAINST('indexing strategies') AS score
FROM articles
WHERE MATCH(title, body) AGAINST('indexing strategies')
ORDER BY score DESC
LIMIT 5;

-- Score 0 means not matched; higher = more relevant
Pro Tip

Words in 50%+ of rows score 0 in natural language mode — too common to be useful.