在 mysql 中为“ft_min_word_len”FULLTEXT 设置新值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14646738/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
set new value for "ft_min_word_len " FULLTEXT in mysql
提问by Rahul Rawat
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
我更改为"ft_min_word_len" = 4
bymy-innodb-heavy-4G.ini
位于我的系统路径中"C:\Program Files\MySQL\MySQL Server 5.1"
,但是当我运行时
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
.
我得到了结果value= 4
。我没有在my.ini
文件中找到这个变量。所以我也创建了一个我的逻辑。我复制到ft_min_word_len
变量并放在my.ini
文件中,现在我的结果显示value=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.
我怎样才能实现也可以搜索三个字符值。
回答by valex
You should change this system parameter, restart server and then rebuild ALL FULLTEXT indexes.
您应该更改此系统参数,重新启动服务器,然后重建 ALL FULLTEXT 索引。
REPAIR TABLE <TableName> QUICK;
回答by pevik
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';
回答by engineer2014
I think you should try altering table by drop index and again add index. It will surely work.
我认为您应该尝试通过删除索引更改表并再次添加索引。它肯定会起作用。
回答by Mahedi Hasan
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;
ALTER TABLE models_new DROP INDEX name;
ALTER TABLE models_new ADD FULLTEXT name (name);
ALTER TABLE models_new DISABLE KEYS;
INSERT INTO models_new SELECT * FROM models;
ALTER TABLE models_new ENABLE KEYS;
ALTER TABLE models RENAME models_old;
ALTER TABLE models_new RENAME models;
回答by greggb
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.
无论如何,我希望这对遇到同样问题的其他人有所帮助。