我在一个项目中使用全文搜索。我想搜索多个单词,但我有一个问题。所以我的查询是;
SELECT MAX(id)
FROM table
WHERE MATCH (col1,col2) AGAINST ('+(word1) +(word2) +(word3 word4)')
GROUP BY col1
ORDER BY 1 desc limit 12
这个查询是包含word1或word2或word3或word4的搜索但我想搜索包括word1或word2或word3 word4
那么解决方案是什么呢?
你可以试试下面这个…
SELECT MAX(id) FROM table WHERE MATCH(colname1,colname2) AGAINST("keyword to search") GROUP BY colname ORDER BY colname desc limit 12
参考SELECT * FROM `user_profiles`
WHERE MATCH (`first_name`,`last_name`)
AGAINST ('(+bruce+wayne)(+clark+kent)' IN BOOLEAN MODE)