2013-07-09 26 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數據有它們的速度差異。一個讀取速度更快,另外一個寫入更快(在互聯網上閱讀更多信息)