我已按照本教程进行 mysql 全文搜索。
我有这张桌子:
CREATE TABLE IF NOT EXISTS `test` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`textrow` varchar(256) NOT NULL,
PRIMARY KEY (`id`),
FULLTEXT KEY `textrow` (`textrow`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
INSERT INTO `test` (`id`, `textrow`) VALUES
(1, 'Agajan Torayev'),
(2, 'torayeff');
ALTER TABLE test ADD FULLTEXT(textrow);
这些查询之间有什么区别(一个给出零结果):
mysql> SELECT * FROM test WHERE MATCH(textrow) AGAINST('agajan');
Empty set (0.00 sec)
和
mysql> SELECT *, MATCH(textrow) AGAINST('agajan') FROM test;
+----+----------------+----------------------------------+
| id | textrow | MATCH(textrow) AGAINST('agajan') |
+----+----------------+----------------------------------+
| 1 | Agajan Torayev | 0 |
| 2 | torayeff | 0 |
+----+----------------+----------------------------------+
2 rows in set (0.00 sec)