我在项目中使用全文搜索。我想搜索多个单词,但我有一个问题。所以我的问题是;
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
那么解决方案是什么?
答案 0 :(得分:0)
你可以试试这样的......
SELECT MAX(id) FROM table WHERE MATCH(colname1,colname2) AGAINST("keyword to search") GROUP BY colname ORDER BY colname desc limit 12
答案 1 :(得分:-1)
SELECT * FROM `user_profiles`
WHERE MATCH (`first_name`,`last_name`)
AGAINST ('(+bruce+wayne)(+clark+kent)' IN BOOLEAN MODE)