gpt4 book ai didi

mysql - 如何获取选择查询选择结果的关键字?

转载 作者:行者123 更新时间:2023-11-30 22:55:55 25 4
gpt4 key购买 nike

如何在MySQL中使用全文搜索MATCH() AGAINST()获取select查询选择结果集的精确关键字

SELECT ... , MATCH(table_column) AGAINST("'LIST_OF_KEYWORDS' IN BOOLEAN MODE") AS relevance

现在我想得到完全匹配的关键字

最佳答案

来自 MySQL 文档:

Find rows that contain the exact phrase “some words” (for example, rows that contain “some words of wisdom” but not “some noise words”). Note that the “"” characters that enclose the phrase are operator characters that delimit the phrase. They are not the quotation marks that enclose the search string itself.

找到确切的短语:

SELECT * FROM your_table 
WHERE MATCH(table_column) AGAINST('"PUT_YOUR_PHRASE"' IN BOOLEAN MODE) AS relevance

至少找到一个关键字:

SELECT * FROM your_table 
WHERE MATCH(table_column) AGAINST('KEYWORD1 KEYWORD2' IN BOOLEAN MODE) AS relevance

在两个关键字处查找:

SELECT * FROM your_table 
WHERE MATCH(table_column) AGAINST('+KEYWORD1 +KEYWORD2' IN BOOLEAN MODE) AS relevance

关于mysql - 如何获取选择查询选择结果的关键字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26376489/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com