2013-07-09 28 views
1

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

enter image description here

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

我能做些什么来修改停止字?

+0

您也可以使用REGEXP命令来匹配表中的搜索项 – Ghostman

回答

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数据有它们的速度差异。一个读取速度更快,另外一个写入更快(在互联网上阅读更多信息)