我有一张桌子。 该表的查询如下
CREATE TABLE IF NOT EXISTS `Table` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`univ_id` int(11) NOT NULL,
`title` varchar(100) NOT NULL,
`content` mediumtext NOT NULL,
`date` date NOT NULL,
PRIMARY KEY (`id`),
FULLTEXT KEY `title` (`title`),
FULLTEXT KEY `content` (`content`),
FULLTEXT KEY `content_2` (`content`),
FULLTEXT KEY `title_2` (`title`),
FULLTEXT KEY `title_3` (`title`),
FULLTEXT KEY `title_4` (`title`),
FULLTEXT KEY `content_3` (`content`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ;
有标题和内容。 当我试图进行搜索时。
SELECT * FROM table WHERE MATCH(title) AGAINST('HAi')
它给出了预期的结果 我正在尝试搜索时
SELECT * FROM table WHERE MATCH(content) AGAINST('HAi')
它给出了预期的结果 但是当我试图像这样进行搜索时
SELECT * FROM table WHERE MATCH(title,content) AGAINST('HAi')
显示
#1191 - Can't find FULLTEXT index matching the column list
答案 0 :(得分:0)
尝试使用以下语句重新创建表:
CREATE TABLE IF NOT EXISTS `table` (
id int(11) NOT NULL AUTO_INCREMENT,
univ_id int(11) NOT NULL,
title varchar(100) NOT NULL,
content mediumtext NOT NULL,
date date NOT NULL, PRIMARY KEY (id),
FULLTEXT KEY title1 (title),
FULLTEXT KEY content (content),
FULLTEXT KEY title (title, content)
)
ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=36
然后你的select
应该运行良好。