gpt4 book ai didi

mysql - 匹配没有结果

转载 作者:搜寻专家 更新时间:2023-10-30 21:56:00 25 4
gpt4 key购买 nike

我在 MySQL 表中进行全文搜索时遇到问题。

MATCH AGAINST 不会返回任何结果,即使我有 7 条记录包含我要查找的词也是如此。我该怎么做才能让它返回行?

SELECT * 
FROM site_plugin_products_cache_texts
WHERE MATCH(item_text) AGAINST ('+your +name' IN BOOLEAN MODE);

No rows.

SELECT * 
FROM site_plugin_products_cache_texts
WHERE item_text LIKE'%your name%'

7 rows (0.071 s)

http://sqlfiddle.com/#!9/70c3fa/1/0

谢谢。

最佳答案

这两个词都包含在 Stopwords for MyISAM Search Indexes 中,它本质上是一个在全文索引中完全忽略的单词列表(因为它们通常出现得太频繁)。

最简单的解决方案是切换到 InnoDB 作为您的引擎,因为它的停用词列表要短得多。如果您需要使用 MyISAM,则必须执行以下操作:

To override the default stopword list for MyISAM tables, set the ft_stopword_file system variable. (See Section 5.1.7, “Server System Variables”.) The variable value should be the path name of the file containing the stopword list, or the empty string to disable stopword filtering. The server looks for the file in the data directory unless an absolute path name is given to specify a different directory. After changing the value of this variable or the contents of the stopword file, restart the server and rebuild your FULLTEXT indexes.

关于mysql - 匹配没有结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50184539/

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