mysql - 匹配没有结果

标签 mysql database

我在 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/

相关文章:

MYSQL - 单个查询中的多个计数

php - MySql 适合大型数据库吗?

python - Tango with Django (v1.9/1.10) - 第 5 章,populate_rango 问题

mysql - 客户端的 WAMP MYSQL 或 MYSQL 服务?

mysql - 列出拥有最多代币的用户

php - 在 Magento 的高级搜索页面中更改属性排序

PHP MYSQL更新查询

mysql - 同时插入两个

mysql - 需要指导我的 Visual Basic 应用程序安装

php - Codeigniter 多数据库连接