如果我有这样的结构:
CREATE TABLE IF NOT EXISTS `sheet` (
`id` int(11) NOT NULL,
`title` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
`html` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `title` (`title`),
FULLTEXT KEY `html` (`html`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
我需要像这样进行全文搜索查询:
SELECT * FROM `cms`
WHERE MATCH ( title, html) AGAINST ('+psoriasis +categorizacion' IN BOOLEAN MODE)
我应该为title
添加FULLTEXT索引吗?
答案 0 :(得分:2)
实际上,您应该修改/替换现有索引,使其覆盖两列(如果您使用WHERE MATCH(title, html)...
,而不是`WHERE MATCH(title)... AND MATCH(html)...
):
CREATE TABLE sheet (
...
FULLTEXT KEY title_html (title, html)
...
)