MySQL FullText Order By Question,MySQL 全文搜索排序问题 MySQL

axiuno 2016-12-19 1047

his might give the increased relevance to the head part that you want. It won't double it, but it might possibly good enough for your sake:

SELECT pages.*,
       MATCH (head, body) AGAINST ('some words') AS relevance,
       MATCH (head) AGAINST ('some words') AS title_relevanceFROM pagesWHERE MATCH (head, body) AGAINST ('some words')ORDER BY title_relevance DESC, relevance DESC-- alternatively:ORDER BY title_relevance + relevance DESC

An alternative that you also want to investigate, if you've the flexibility to switch DB engine, is Postgres. It allows to set the weight of operators and to play around with the ranking.

最新回复 (0)