mysql修改全文搜索的停用词列表 [英] mysql Modify stopword list for fulltext search

查看:799
本文介绍了mysql修改全文搜索的停用词列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了很多,据说我必须编辑my.cnf文件来更改停用词列表。
我将my-medium.cnf重命名为my.cnf,并添加了ft_query_expansion_limit和ft_stopword_file条件。我重新启动了mySQL。但它没有生效。我没有管理员权限。

I've searched a lot, it's said that I have to edit my.cnf file to change the stopword list. I renamed my-medium.cnf to my.cnf and added the ft_query_expansion_limit and ft_stopword_file conditions. I have restarted mySQL. But it is not taking effect. I dont have admin privileges.

# 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)

如何修改停用词表?

推荐答案

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

In my.ini text file (MySQL) :

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

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

// set your minimum length, but be aware that shorter words (3,2) will increase the query time dramatically, especially if the fulltext indexed column fields are large.

保存文件,重启服务器。

Save the file, restart the server.

下一步应该是用这个查询修复索引:

The next step should be to repair the indexes with this query:

REPAIR TABLE tbl_name QUICK.

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

However, this will not work if you table is using InnoDB storage engine. You will have to change it to MyISAM :

ALTER TABLE t1 ENGINE = MyISAM;

所以,再次说明:

So, once again:

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的速度有所不同。一个阅读速度更快,另外一个阅读速度更快(阅读关于互联网的更多信息)

Be aware that InnoDB and MyISAM have their speed differences. One read faster, other writes faster ( read more about that on the internet )

这篇关于mysql修改全文搜索的停用词列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆