Get the number of occurrences of found matches in fulltext search?
I am curious whether in a regular fulltext search:
mysql_query("SELECT post_subject,topic_id,forum_id,post_text
FROM phpbb_posts
WHERE MATCH (post_subj开发者_JAVA技巧ect,post_text)
AGAINST ('".$dtitle."')
GROUP BY post_subject
LIMIT 50") or DIE(mysql_error());
I am able to get the result of number of found matches to sort by.
So I could do something like ORDER BY number_of_keywords desc
From the docs:
When MATCH() is used in a WHERE clause, as in the example shown earlier, the rows returned are automatically sorted with the highest relevance first.
So the results are already sorted by relevance.
Relevance is computed based on the number of words in the row, the number of unique words in that row, the total number of words in the collection, and the number of documents (rows) that contain a particular word.
The rest of the page might be interesting too.
精彩评论