MATCH AGAINST with multiple columns in MySQL

后端 未结 1 962
误落风尘
误落风尘 2020-12-20 09:09

I am trying to create a simplified search box that will match multiple columns against a keyword or keywords the user inputs. The following code is my attempt at using MySQL

相关标签:
1条回答
  • 2020-12-20 09:53

    You don't need fulltext indices for each column, but a single fulltext index covering both columns

    FULLTEXT_INDEX(topic, country)
    

    Having a single index on each column will not work

    FULLTEXT(topic); FULLTEXT(country); /* will not work as expected */
    

    I also think that order is important, but I could be mistaken in that regard

    0 讨论(0)
提交回复
热议问题