我正在尝试使FULLTEXT与我的数据库一起使用。这是一个已经存在的MyISAM数据库:
id BIGINT PRIMARY KEY NOT NULL AUTO_INCREMENT UNIQUE,
disabled TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
owner BIGINT NOT NULL,
category VARCHAR(12) NOT NULL,
title VARCHAR(64) NOT NULL DEFAULT 'My Product',
`condition` VARCHAR(4) NOT NULL DEFAULT 'new',
summary VARCHAR(96) NOT NULL DEFAULT 'Product Details',
quantity TINYINT(1) UNSIGNED,
price DECIMAL(7,2),
status TINYINT(1) UNSIGNED,
released DATE,
freight DECIMAL(5,2),
freightX DECIMAL(5,2),
overview TEXT,
warranty TEXT,
notes TEXT,
specList TEXT,
suspended TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
created DATETIME NOT NULL,
updated DATETIME NOT NULL,
所以我运行了命令:
"ALTER TABLE ".PREFIX."Shop ADD FULLTEXT(title,summary,overview,specList)"
我没有错误。然后,我尝试在数据库上进行搜索:
"SELECT
tblShop.id,tblShop.title,tblShop.summary,tblShop.overview,tblShop.specList,tblFilters.PID,tblFilters.filter
FROM
".PREFIX."Shop tblShop
INNER JOIN
".PREFIX."ShopFilters tblFilters ON tblShop.id = tblFilters.PID
WHERE
tblShop.disabled='0' AND tblFilters.disabled='0' AND tblFilters.filter IN ('".$filters."') AND MATCH(tblShop.title,tblShop.summary,tblShop.overview,tblShop.specList) AGAINST(\"".$_POST['query']."\")
GROUP BY
id
HAVING
COUNT(tblFilters.filter)=".$count."
ORDER BY
MATCH(tblShop.title) AGAINST(\"".$_POST['query']."\"),title ASC"
我似乎得到的都是错误说明:
"Can't find FULLTEXT index matching the column list"
我已经确认索引实际上是通过myPHPAdmin存在的。我还尝试过:
tblShop.disabled='0' AND tblFilters.disabled='0' AND tblFilters.filter IN ('".$filters."') AND MATCH(tblShop.title,tblShop.summary,tblShop.overview,tblShop.specList) AGAINST(\"".$_POST['query']."\")
tblShop.disabled='0' AND tblFilters.disabled='0' AND tblFilters.filter IN ('".$filters."') AND MATCH(title) AGAINST(\"".$_POST['query']."\")
不知道发生了什么。任何帮助将不胜感激!