How can I manipulate MySQL fulltext search relevance to make one field more 'valuable' than another?

前端 未结 9 1759
灰色年华
灰色年华 2020-11-28 02:55

Suppose I have two columns, keywords and content. I have a fulltext index across both. I want a row with foo in the keywords to have more relevance than a row with foo in th

9条回答
  •  情书的邮戳
    2020-11-28 03:18

    Well, that depends on what do you exactly mean with:

    I want a row with foo in the keywords to have more relevance than a row with foo in the content.

    If you mean that a row with foo in the keywords should come before any row with foo in the content, then I will do two separate queries, one for the keywords and then (possibly lazily, only if it's requested) the other one on the content.

提交回复
热议问题