0
如果我搜索單詞hello
然後我沒有匹配,而我搜索單詞hella
然後我得到了比賽。單詞Non
發生同樣的事情。我在Mac和sqlfiddle.com上的MAMP上進行了測試,結果相同。你知道爲什麼嗎? 下面是測試:http://sqlfiddle.com/#!2/40658/1FULLTEXT mysql搜索不工作
CREATE TABLE IF NOT EXISTS `product` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`name` TEXT default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
INSERT INTO `product` (`name`) VALUES ("hello SANYO MC-1234");
INSERT INTO `product` (`name`) VALUES ("hella SANYO MC-1234");
INSERT INTO `product` (`name`) VALUES ("Non SONY");
INSERT INTO `product` (`name`) VALUES ("mac SONY");
拿到1場:
SELECT *, MATCH (`name`) AGAINST ('+hella*' IN BOOLEAN MODE) as `score` FROM `product` WHERE MATCH (`name`) AGAINST ('+hella*' IN BOOLEAN MODE) ORDER BY `score` DESC
得到0的比賽:
SELECT *, MATCH (`name`) AGAINST ('+hello*' IN BOOLEAN MODE) as `score` FROM `product` WHERE MATCH (`name`) AGAINST ('+hello*' IN BOOLEAN MODE) ORDER BY `score` DESC
我明白了。謝謝! – user3985030 2014-08-28 02:36:23