gpt4 book ai didi

MySQL FULLTEXT 找不到索引

转载 作者:行者123 更新时间:2023-11-29 02:47:09 29 4
gpt4 key购买 nike

我尝试运行以下查询

SELECT * FROM complains WHERE match(title, description) against('+lorem' IN BOOLEAN MODE)

表提示有两个 FULLTEXT 索引。标题和描述,但我仍然从 MySQL 得到这个错误

Error Code: 1191. Can't find FULLTEXT index matching the column list

但是我可以对每一行单独运行查询

SELECT * FROM complains WHERE match(description) against('+lorem' IN BOOLEAN MODE)
SELECT * FROM complains WHERE match(title) against('+lorem' IN BOOLEAN MODE)

这很好用。我缺少什么?

enter image description here

最佳答案

如果您在 match() 运算符中列出多个字段并使用 bool 模式和 innodb 表引擎,那么您需要有一个覆盖这些字段的多列全文索引,如关于 Boolean Full-Text Searches 的 MySQL 文档说:

InnoDB tables require a FULLTEXT index on all columns of the MATCH() expression to perform boolean queries. Boolean queries against a MyISAM search index can work even without a FULLTEXT index, although a search executed in this fashion would be quite slow.

关于MySQL FULLTEXT 找不到索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40553337/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com