# match text and order of the result by search string match count relevance.
SELECT *,
MATCH (title,content) AGAINST ('search words') AS relevance
FROM
USERS
WHERE
MATCH (title,content) AGAINST ('search words')
ORDER BY
relevance DESC;
# match with title and content but order of the result is title_relevance and then title with content relevance
SELECT *,
MATCH (title,content) AGAINST ('search words') AS relevance,
MATCH (title) AGAINST ('search words') AS title_relevance
FROM
USERS
WHERE
MATCH (title,content) AGAINST ('search words')
ORDER BY
title_relevance DESC,
relevance DESC;
|