【发布时间】:2014-06-24 19:33:11
【问题描述】:
我正在尝试实现完整的测试搜索。为此,我首先将 /etc/mysql/my.cnf 上 ft_min_word_len = 2 的值更改为
[mysqld]
#
# * Basic Settings
#
#
# * IMPORTANT
# If you make changes to these settings and your system uses apparmor, you may
# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#
ft_min_word_len = 2
现在保存并重新启动服务器。 我知道,如果我已经在表中有一个带有 FULLTEXT 的索引,我将需要删除索引并重建或修复表。 但我已将表格创建为
create table
`comments`
( `id` int(11),
`comment` varchar(200),
`iduser` int(11) ,
`date_added` datetime
)
ENGINE=MyISAM;
ALTER TABLE comments
ADD FULLTEXT INDEX comment_index
(comment);
然后在上表中我手动添加了一些 cmets。
当我尝试以
的形式搜索某些内容时SELECT * FROM comments where MATCH (comment) AGAINST ('the') ; // "the" is very common word of length to see my test result
它返回 0 行。
但是,如果我将 AGAINST 设置为 4 字长,它会起作用。
我试图检查 ft_ 变量为
mysql> show variables like 'ft_%';
+--------------------------+----------------+
| Variable_name | Value |
+--------------------------+----------------+
| ft_boolean_syntax | + -><()~*:""&| |
| ft_max_word_len | 84 |
| ft_min_word_len | 2 |
| ft_query_expansion_limit | 20 |
| ft_stopword_file | (built-in) |
+--------------------------+----------------+
有趣的是/etc/mysql/my.cnf 我只能看到ft_min_word_len 但ft_max_word_len 不存在,更重要的是,小于长度 4 的搜索根本不起作用。
这让我发疯了,不确定是否还有其他配置写完所有内容并且似乎也无法找到它们。
任何帮助将不胜感激。
我的开发机中的Mysql版本是
mysql Ver 14.14 Distrib 5.1.63, for debian-linux-gnu (i686) using readline 6.2
【问题讨论】:
标签: mysql ubuntu full-text-search