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

前端 未结 9 1725
灰色年华
灰色年华 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:19

    In Boolean mode, MySQL supports the ">" and "<" operator to change a word's contribution to the relevance value that is assigned to a row.

    I wonder if something like this would work?

    SELECT *, 
    MATCH (Keywords) AGAINST ('>watermelon' IN BOOLEAN MODE) AS relStrong, 
    MATCH (Title,Keywords,Content) AGAINST ('

提交回复
热议问题