mysql取消全文搜索_mysql修改全文搜索的停用词列表

bd96500e110b49cbb3cd949968f18be7.png

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.

bIiW3.png

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

What can I do to modify the stopword list?

解决方案

In my.ini text file (MySQL) :

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

ft_min_word_len = 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.

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.

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值