gpt4 book ai didi

sql - MySQL:在全文搜索中查找多个单词 - 仅完全匹配

转载 作者:行者123 更新时间:2023-11-29 01:25:04 25 4
gpt4 key购买 nike

我正在编写一些代码来自动标记一些文章。

我有一个标签数组和一个文章表。我运行以下查询来检查与标签匹配的标题:

SELECT headline 
FROM `news`
WHERE MATCH(headline) AGAINST ("+Green +Day" IN BOOLEAN MODE)

这会找到标题中包含确切短语“Green Day”的所有文章 - 如果没有第一个 +,我得到的文章只包含“Green”一词。

这并不完美,有些标签会导致不准确的结果——例如名为 Die! 的标签。死! Die!(不要问)返回每个标题中都包含“die”一词。

我在这里明显遗漏了什么吗?我想要的只是获得包含整个短语的标题,而且标题的输入方式与输入的方式完全相同。

最佳答案

据我所见docs ,使用引号就足够了。来自文档页面上的示例:

"some words"

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.

关于sql - MySQL:在全文搜索中查找多个单词 - 仅完全匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3596590/

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