文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

14.9.5 全文限制14.9.5 Full-Text Restrictions

  • 全文搜索仅支持 InnoDB 和 MyISAM 表。Full-text searches are supported for InnoDB and MyISAM tables only.

  • 不支持分区表的全文搜索。请参阅 第 26.6 节,“分区的限制和局限”。Full-text searches are not supported for partitioned tables. See Section 26.6, “Restrictions and Limitations on Partitioning”.

  • 全文搜索可以与大多数多字节字符集一起使用。例外情况是,对于 Unicode,可以使用 utf8mb3 或 utf8mb4 字符集,但不能使用 ucs2 字符集。尽管不能在 ucs2 列上使用 FULLTEXT 索引,但您可以对没有此类索引的 ucs2 列执行 IN BOOLEAN MODE 搜索。Full-text searches can be used with most multibyte character sets. The exception is that for Unicode, the utf8mb3 or utf8mb4 character set can be used, but not the ucs2 character set. Although FULLTEXT indexes on ucs2 columns cannot be used, you can perform IN BOOLEAN MODE searches on a ucs2 column that has no such index.

    对 utf8mb3 的说明也适用于 utf8mb4,对 ucs2 的说明也适用于 utf16、utf16le 和 utf32。The remarks for utf8mb3 also apply to utf8mb4, and the remarks for ucs2 also apply to utf16, utf16le, and utf32.

  • 象形文字语言如中文和日文没有单词分隔符。因此,内置的全文解析器 无法确定这些及其他类似语言中的单词起止。Ideographic languages such as Chinese and Japanese do not have word delimiters. Therefore, the built-in full-text parser cannot determine where words begin and end in these and other such languages.

    提供了一个基于字符的 ngram 全文解析器,支持中文、日文和韩文 (CJK),以及一个基于单词的 MeCab 解析器插件,支持日文,可用于 InnoDB 和 MyISAM 表。A character-based ngram full-text parser that supports Chinese, Japanese, and Korean (CJK), and a word-based MeCab parser plugin that supports Japanese are provided for use with InnoDB and MyISAM tables.

  • 虽然支持在单个表中使用多种字符集,但 FULLTEXT 索引中的所有列必须使用相同的字符集和排序规则。Although the use of multiple character sets within a single table is supported, all columns in a FULLTEXT index must use the same character set and collation.

  • MATCH() 列表必须与表中某个 FULLTEXT 索引定义中的列列表完全匹配,除非该 MATCH() 在 MyISAM 表上使用 IN BOOLEAN MODE。对于 MyISAM 表,布尔模式搜索可以在非索引列上进行,尽管它们可能会很慢。The MATCH() column list must match exactly the column list in some FULLTEXT index definition for the table, unless this MATCH() is IN BOOLEAN MODE on a MyISAM table. For MyISAM tables, boolean-mode searches can be done on nonindexed columns, although they are likely to be slow.

  • AGAINST() 的参数必须是在查询评估期间保持不变的字符串值。例如,这排除了表列,因为表列的值可能因每行而异。The argument to AGAINST() must be a string value that is constant during query evaluation. This rules out, for example, a table column because that can differ for each row.

    MATCH() 的参数不能使用汇总列。The argument to MATCH() cannot use a rollup column.

  • 相比非 FULLTEXT 搜索,FULLTEXT 搜索的索引提示更受限制。参见 第 10.9.4 节,“索引提示”。Index hints are more limited for FULLTEXT searches than for non-FULLTEXT searches. See Section 10.9.4, “Index Hints”.

  • 对于 InnoDB,涉及带有全文索引列的所有 DML 操作(INSERT、UPDATE、DELETE)在事务提交时处理。例如,对于 INSERT 操作,插入的字符串会被分词并分解为单个单词。然后在事务提交时,这些单词会被添加到全文索引表中。因此,全文搜索只会返回已提交的数据。For InnoDB, all DML operations (INSERT, UPDATE, DELETE) involving columns with full-text indexes are processed at transaction commit time. For example, for an INSERT operation, an inserted string is tokenized and decomposed into individual words. The individual words are then added to full-text index tables when the transaction is committed. As a result, full-text searches only return committed data.

  • “%”字符不是全文搜索支持的通配符字符。The '%' character is not a supported wildcard character for full-text searches.