是否可以通过Mysql中的全文搜索获取关键字命中总数?
SELECT id, description, SUM_TOTAL_KEYWORD_HITS
FROM table
WHERE MATCH (description) AGAINST('keyword1 keyword2')
然后让它返回:
+----+---------------------+----------------------+
| ID | description | totalkeywordhits |
+----+---------------------+----------------------+
| 1 | Penny is a dog | 2 |
| 2 | Gandalf is a human | 1 |
+----+---------------------+----------------------+
答案 0 :(得分:-1)
可能选择匹配条款的总分
SELECT id, description, (SELECT MATCH(description) AGAINST('keyword1 keyword2')) AS score
FROM table
WHERE MATCH (description) AGAINST('keyword1 keyword2');
对于关键字计数,您必须拆分关键字并单独与所有人匹配,以便尝试:)