检查您的ft_min_word_len系统变量。这定义了要索引的单词的最小长度。
更新:好的我用ft_min_word_len=3做了一些测试
首先是一张测试表
CREATE TABLE `test`.`table1` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` TEXT NULL ,
PRIMARY KEY (`id`) ,
FULLTEXT INDEX `Name` (`name` ASC) )
ENGINE = MyISAM;接下来一些测试数据:
INSERT INTO `test`.`table1` (`id`, `name`) VALUES ('1', 'This has led in it');
INSERT INTO `test`.`table1` (`id`, `name`) VALUES ('2', 'Led is nice');
INSERT INTO `test`.`table1` (`id`, `name`) VALUES ('3', 'Leds are nicer');
INSERT INTO `test`.`table1` (`id`, `name`) VALUES ('4', 'Nothin here');
INSERT INTO `test`.`table1` (`id`, `name`) VALUES ('5', 'some word which does not exists: abcleddef');运行这个:
SELECT * FROM `test`.`table1` t1 WHERE match(`t1`.`name`) against ('led' in boolean mode)返回此:
1 This has led in it
2 Led is nice运行这个:
SELECT * FROM `test`.`table1` t1 WHERE match(`t1`.`name`) against ('led*' in boolean mode)返回此:
1 This has led in it
2 Led is nice
3 Leds are nicer因此FT搜索按预期工作。您试图找到的单词实际上是leds,而不是单词led?