表结构如下:

 CREATE TABLE `T` (
....
FULLTEXT KEY `title_fc` (`titleindex`),
FULLTEXT KEY `shortname_fc` (`shortnameindex`)
) ENGINE=InnoDB AUTO_INCREMENT=50962041 DEFAULT CHARSET=utf8

创建了两个全文索引,但是在查找的时候,却出现如下这样的错误。

mysql> SELECT count(1) as count FROM T a WHERE 1 = 1  AND MATCH (a.titleindex) AGAINST ('"5YeM 5Yqo"' IN BOOLEAN MODE );
+-------+
| count |
+-------+
| 70 |
+-------+
1 row in set (0.01 sec) mysql> SELECT count(1) as count FROM T a WHERE 1 = 1 AND MATCH (a.shortnameindex) AGAINST ('"5YeM 5Yqo"' IN BOOLEAN MODE ) ;
+-------+
| count |
+-------+
| 6 |
+-------+
1 row in set (0.00 sec) mysql> SELECT count(1) as count FROM T a WHERE 1 = 1 AND MATCH (a.shortnameindex ,a.titleindex) AGAINST ('"5YeM 5Yqo"' IN BOOLEAN MODE ) ;
ERROR 1191 (HY000): Can't find FULLTEXT index matching the column list

单独match某一列可以正常查询,但是match多列就报错。

后来从MySQL的文档上面找到:The MATCH() column list must match exactly the column list in some FULLTEXT index definition for the table, unless this MATCH() is IN BOOLEAN MODE on a MyISAM table.

05-11 22:03