I changed to "ft_min_word_len" = 4
by my-innodb-heavy-4G.ini
located in my system path "C:\Program Files\MySQL\MySQL Server 5.1"
, but when i run
我在我的系统路径“C:\ Program Files \ MySQL \ MySQL Server 5.1”中的my-innodb-heavy-4G.ini更改为“ft_min_word_len”= 4,但是当我运行时
SHOW VARIABLES LIKE 'ft_min_word_len'
I got still result value= 4
. I did not find this variable in my.ini
file. So i have also create a my logic. I copied to ft_min_word_len
variable and place in my.ini
file and now my result show value=3
.
我得到了结果值= 4.我在my.ini文件中找不到这个变量。所以我也创造了一个逻辑。我复制到ft_min_word_len变量并放在my.ini文件中,现在我的结果显示值= 3。
But it is not working for three character search. I've restarted server.
但它不适用于三字符搜索。我重新启动了服务器。
How can i achieve to be able to search three character value also.
如何才能实现能够搜索三个字符值。
5 个解决方案
#1
19
You should change this system parameter, restart server and then rebuild ALL FULLTEXT indexes.
您应该更改此系统参数,重新启动服务器,然后重建所有FULLTEXT索引。
REPAIR TABLE <TableName> QUICK;
- Change the full text index minimum word length with MySQL
- 使用MySQL更改全文索引最小字长
#2
6
This is what I use for getting all needed repair commands:
这是我用于获取所有需要的修复命令:
SELECT DISTINCT CONCAT("REPAIR TABLE `", TABLE_SCHEMA, "`.`",
TABLE_NAME, "` QUICK;") FROM information_schema.STATISTICS
WHERE index_type = 'FULLTEXT';
#3
3
I think you should try altering table by drop index and again add index. It will surely work.
我认为你应该尝试逐个删除索引并再次添加索引。它肯定会奏效。
#4
0
You could just drop and add the FULLTEXT index
您可以删除并添加FULLTEXT索引
or do it in stages and see how big it will get in advance
或分阶段进行,看看它会提前有多大
CREATE TABLE models_new LIKE models;
CREATE TABLE models_new LIKE模型;
ALTER TABLE models_new DROP INDEX name;
ALTER TABLE models_new DROP INDEX名称;
ALTER TABLE models_new ADD FULLTEXT name (name);
ALTER TABLE models_new ADD FULLTEXT名称(名称);
ALTER TABLE models_new DISABLE KEYS;
ALTER TABLE models_new DISABLE KEYS;
INSERT INTO models_new SELECT * FROM models;
INSERT INTO models_new SELECT * FROM models;
ALTER TABLE models_new ENABLE KEYS;
ALTER TABLE models_new ENABLE KEYS;
ALTER TABLE models RENAME models_old;
ALTER TABLE模型RENAME models_old;
ALTER TABLE models_new RENAME models;
ALTER TABLE models_new RENAME模型;
#5
0
I just had and solved a similar problem of my own. The problem in my case is that the my.ini file I needed to edit in order to change the ft_min_word_len variable was in a directory that's hidden/protected by default in Windows 7. That's: "c:/programdata/mysql/mysql server 5.7".
我刚刚解决了类似的问题。我的问题是,为了更改ft_min_word_len变量,我需要编辑的my.ini文件位于Windows 7默认隐藏/保护的目录中。即:“c:/ programdata / mysql / mysql server 5.7 ”。
Windows file explorer and searches don't show this location until you go into folder options and specify that you want to see hidden files/folders (and possibly protected operating system files--I did both).
在您进入文件夹选项并指定要查看隐藏文件/文件夹(以及可能受保护的操作系统文件 - 我同时执行这两个操作)之前,Windows文件资源管理器和搜索不会显示此位置。
Initially I created a my.cnf file under Program Files/MySQL Server 5.7. But when I restarted the server the ft_min_word_len variable hadn't changed. Then I typed in some random text that I knew should trigger an error, but the server started up like normal. It seems that MySQL wasn't reading the file, even though it was in one of the locations specified in the help text from the MySQL client shell.
最初我在Program Files / MySQL Server 5.7下创建了一个my.cnf文件。但是当我重新启动服务器时,ft_min_word_len变量没有改变。然后我输入了一些我知道应该触发错误的随机文本,但服务器启动时正常。似乎MySQL没有读取文件,即使它位于MySQL客户端shell的帮助文本中指定的位置之一。
My thinking is that the MySQL server starts searching for .cnf/.ini files in the order specified in the help text, but once it finds a valid file, stops searching. Just a theory, but I can say for sure that it wasn't recognizing configuration files in the other places it was supposed to be looking.
我的想法是MySQL服务器开始按帮助文本中指定的顺序搜索.cnf / .ini文件,但一旦找到有效文件,就停止搜索。只是一个理论,但我可以肯定地说它没有识别它本应该看的其他地方的配置文件。
I figured it was like CSS, where each new CSS file overrides settings in the previous. Evidently not.
我认为它就像CSS,每个新的CSS文件都覆盖了之前的设置。显然不是。
Anyway, I hope this will be of help to anyone else who runs into the same problem.
无论如何,我希望这会对遇到同样问题的其他人有所帮助。
#1
19
You should change this system parameter, restart server and then rebuild ALL FULLTEXT indexes.
您应该更改此系统参数,重新启动服务器,然后重建所有FULLTEXT索引。
REPAIR TABLE <TableName> QUICK;
- Change the full text index minimum word length with MySQL
- 使用MySQL更改全文索引最小字长
#2
6
This is what I use for getting all needed repair commands:
这是我用于获取所有需要的修复命令:
SELECT DISTINCT CONCAT("REPAIR TABLE `", TABLE_SCHEMA, "`.`",
TABLE_NAME, "` QUICK;") FROM information_schema.STATISTICS
WHERE index_type = 'FULLTEXT';
#3
3
I think you should try altering table by drop index and again add index. It will surely work.
我认为你应该尝试逐个删除索引并再次添加索引。它肯定会奏效。
#4
0
You could just drop and add the FULLTEXT index
您可以删除并添加FULLTEXT索引
or do it in stages and see how big it will get in advance
或分阶段进行,看看它会提前有多大
CREATE TABLE models_new LIKE models;
CREATE TABLE models_new LIKE模型;
ALTER TABLE models_new DROP INDEX name;
ALTER TABLE models_new DROP INDEX名称;
ALTER TABLE models_new ADD FULLTEXT name (name);
ALTER TABLE models_new ADD FULLTEXT名称(名称);
ALTER TABLE models_new DISABLE KEYS;
ALTER TABLE models_new DISABLE KEYS;
INSERT INTO models_new SELECT * FROM models;
INSERT INTO models_new SELECT * FROM models;
ALTER TABLE models_new ENABLE KEYS;
ALTER TABLE models_new ENABLE KEYS;
ALTER TABLE models RENAME models_old;
ALTER TABLE模型RENAME models_old;
ALTER TABLE models_new RENAME models;
ALTER TABLE models_new RENAME模型;
#5
0
I just had and solved a similar problem of my own. The problem in my case is that the my.ini file I needed to edit in order to change the ft_min_word_len variable was in a directory that's hidden/protected by default in Windows 7. That's: "c:/programdata/mysql/mysql server 5.7".
我刚刚解决了类似的问题。我的问题是,为了更改ft_min_word_len变量,我需要编辑的my.ini文件位于Windows 7默认隐藏/保护的目录中。即:“c:/ programdata / mysql / mysql server 5.7 ”。
Windows file explorer and searches don't show this location until you go into folder options and specify that you want to see hidden files/folders (and possibly protected operating system files--I did both).
在您进入文件夹选项并指定要查看隐藏文件/文件夹(以及可能受保护的操作系统文件 - 我同时执行这两个操作)之前,Windows文件资源管理器和搜索不会显示此位置。
Initially I created a my.cnf file under Program Files/MySQL Server 5.7. But when I restarted the server the ft_min_word_len variable hadn't changed. Then I typed in some random text that I knew should trigger an error, but the server started up like normal. It seems that MySQL wasn't reading the file, even though it was in one of the locations specified in the help text from the MySQL client shell.
最初我在Program Files / MySQL Server 5.7下创建了一个my.cnf文件。但是当我重新启动服务器时,ft_min_word_len变量没有改变。然后我输入了一些我知道应该触发错误的随机文本,但服务器启动时正常。似乎MySQL没有读取文件,即使它位于MySQL客户端shell的帮助文本中指定的位置之一。
My thinking is that the MySQL server starts searching for .cnf/.ini files in the order specified in the help text, but once it finds a valid file, stops searching. Just a theory, but I can say for sure that it wasn't recognizing configuration files in the other places it was supposed to be looking.
我的想法是MySQL服务器开始按帮助文本中指定的顺序搜索.cnf / .ini文件,但一旦找到有效文件,就停止搜索。只是一个理论,但我可以肯定地说它没有识别它本应该看的其他地方的配置文件。
I figured it was like CSS, where each new CSS file overrides settings in the previous. Evidently not.
我认为它就像CSS,每个新的CSS文件都覆盖了之前的设置。显然不是。
Anyway, I hope this will be of help to anyone else who runs into the same problem.
无论如何,我希望这会对遇到同样问题的其他人有所帮助。