3

查了很多,都说要修改my.cnf文件才能更改停用词列表。我将 my-medium.cnf 重命名为 my.cnf 并添加了 ft_query_expansion_limit 和 ft_stopword_file 条件。我已经重新启动了 mySQL。但它没有生效。我没有管理员权限。

在此处输入图像描述

# The MySQL server
[mysqld]
port        = 3306
socket      = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
ft_query_expansion_limit = 10
ft_stopword_file = 'D:/mysql/stopword.txt'


mysql> show variables like '%ft%';
+--------------------------+----------------+
| Variable_name            | Value          |
+--------------------------+----------------+
| ft_boolean_syntax        | + -><()~*:""&| |
| ft_max_word_len          | 84             |
| ft_min_word_len          | 4              |
| ft_query_expansion_limit | 20             |
| ft_stopword_file         | (built-in)     |
+--------------------------+----------------+
5 rows in set (0.00 sec)

如何修改停用词列表?

4

1 回答 1

0

在 my.ini 文本文件 (MySQL) 中:

ft_stopword_file = ""   or link an empty file "empty_stopwords.txt"
ft_min_word_len = 2 

// 设置最小长度,但要注意较短的单词 (3,2) 会显着增加查询时间,尤其是在全文索引列字段很大的情况下。

保存文件,重启服务器。

下一步应该是使用此查询修复索引:

REPAIR TABLE tbl_name QUICK.

但是,如果您的表使用 InnoDB 存储引擎,这将不起作用。您必须将其更改为 MyISAM :

ALTER TABLE t1 ENGINE = MyISAM;

所以,再一次:

1. Edit my.ini file and save
2. Restart your server (this cannot be done dynamically)
3. Change the table engine (if needed)  ALTER TABLE tbl_name ENGINE = MyISAM;
4. Perform repair                       REPAIR TABLE tbl_name QUICK.

请注意,InnoDB 和 MyISAM 有它们的速度差异。一个读得更快,另一个写得更快(在互联网上阅读更多相关信息)

于 2013-08-02T14:53:35.377 回答