MySQL匹配仅在我匹配一列时才起作用

时间:2014-09-01 01:58:46

标签: mysql

我试图让这个查询工作(从小时起......),但我无法弄清楚错误:

SELECT title,text, MATCH(title,text) AGAINST ('".$key."') AS score 
FROM ml_products WHERE MATCH(title,text) AGAINST ('".$key."' IN BOOLEAN MODE) 
ORDER BY score DESC LIMIT 0,10

顺便说一句,如果我只匹配标题(或仅匹配文本),它会起作用,例如:

SELECT title,text, MATCH(title) AGAINST ('".$key."') AS score 
FROM ml_products WHERE MATCH(title) AGAINST ('".$key."' IN BOOLEAN MODE) 
ORDER BY score DESC LIMIT 0,10

标题和文字都是FULLTEXT键

这是我的表:

CREATE TABLE `ml_products` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `id_prod` int(11) unsigned NOT NULL,
  `ml_code` varchar(2) NOT NULL,
  `title` varchar(86) NOT NULL,
  `text` text NOT NULL,
  `descr` varchar(180) NOT NULL,
  PRIMARY KEY (`id`),
  FULLTEXT KEY `title` (`title`),
  FULLTEXT KEY `text` (`text`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=570 ;

为什么它仅在第二种情况下起作用的原因是什么?

提前感谢您提供任何帮助

0 个答案:

没有答案