全文搜索在多列中不起作用

qaxu7uf2  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(231)
SELECT `id`, `name`, `frontCover`, `type`, `category`, `user`, `author`, `MRP`, `sellingPrice`, `isNew`, `isRaw`, `binding`, `publisherName`, `publicationYear`, (MATCH name,author AGAINST ("made easy editorial board" IN BOOLEAN MODE)) AS relevance FROM `books` WHERE LOWER(type) = 'college' AND (MATCH name,author AGAINST ('made easy editorial board' IN BOOLEAN MODE)) AND `status` = 1 ORDER BY `relevance` DESC

当试图运行查询时,它给我错误


# 1191 - Can't find FULLTEXT index matching the column list

我已经添加了name和author全文索引。但当我运行单列时,它就工作了。我需要从两列匹配结果得到。

plicqrtu

plicqrtu1#

在查询中使用这两列时,需要在这两列上使用一个组合的全文索引。

ALTER TABLE `books` 
ADD FULLTEXT INDEX `IDX_FULLTEXT_NAME_AUTHOR` (`name` ASC, `author` ASC);

相关问题