MySQL 匹配 3 个字符表达式
MySQL MATCH AGAINST 3 character expressions
当我运行以下
MATCH(my_text) AGAINST ('"hey"' IN BOOLEAN MODE)
我得到包含 hey
的所有行的结果
当我运行以下
MATCH(my_text) AGAINST ('"n=3"' IN BOOLEAN MODE)
我得到零结果,即使有 2 行包含 n=3
table有
fulltext
指数
utf8_general_ci
整理
ENGINE=InnoDB
innodb_ft_min_token_size = 3
ft_min_word_len = 4
mysql version = 5.6.10
我怀疑它与 =
有关,但不确定如何使用 *()+
来表现它需要的方式,尝试了几种不同的组合但没有成功。
=
不被视为单词字符,因此未编入索引
来自:https://dev.mysql.com/doc/refman/8.0/en/fulltext-fine-tuning.html
Character Set Modifications
For the built-in full-text parser, you can change the set of
characters that are considered word characters in several ways, as
described in the following list. After making the modification,
rebuild the indexes for each table that contains any FULLTEXT indexes.
Suppose that you want to treat the hyphen character ('-') as a word
character. Use one of these methods:
Modify the MySQL source: In storage/innobase/handler/ha_innodb.cc (for InnoDB), or in storage/myisam/ftdefs.h (for MyISAM), see the
true_word_char() and misc_word_char() macros. Add '-' to one of those
macros and recompile MySQL.
Modify a character set file: This requires no recompilation. The true_word_char() macro uses a “character type” table to distinguish
letters and numbers from other characters. . You can edit the contents
of the array in one of the character set XML files to
specify that '-' is a “letter.” Then use the given character set for
your FULLTEXT indexes. For information about the array
format, see Section 10.12.1, “Character Definition Arrays”.
Add a new collation for the character set used by the indexed columns, and alter the columns to use that collation. For general
information about adding collations, see Section 10.13, “Adding a
Collation to a Character Set”. For an example specific to full-text
indexing, see Section 12.9.7, “Adding a Collation for Full-Text
Indexing”.
当我运行以下
MATCH(my_text) AGAINST ('"hey"' IN BOOLEAN MODE)
我得到包含 hey
当我运行以下
MATCH(my_text) AGAINST ('"n=3"' IN BOOLEAN MODE)
我得到零结果,即使有 2 行包含 n=3
table有
fulltext
指数
utf8_general_ci
整理
ENGINE=InnoDB
innodb_ft_min_token_size = 3
ft_min_word_len = 4
mysql version = 5.6.10
我怀疑它与 =
有关,但不确定如何使用 *()+
来表现它需要的方式,尝试了几种不同的组合但没有成功。
=
不被视为单词字符,因此未编入索引
来自:https://dev.mysql.com/doc/refman/8.0/en/fulltext-fine-tuning.html
Character Set Modifications
For the built-in full-text parser, you can change the set of characters that are considered word characters in several ways, as described in the following list. After making the modification, rebuild the indexes for each table that contains any FULLTEXT indexes. Suppose that you want to treat the hyphen character ('-') as a word character. Use one of these methods:
Modify the MySQL source: In storage/innobase/handler/ha_innodb.cc (for InnoDB), or in storage/myisam/ftdefs.h (for MyISAM), see the
true_word_char() and misc_word_char() macros. Add '-' to one of those macros and recompile MySQL.
Modify a character set file: This requires no recompilation. The true_word_char() macro uses a “character type” table to distinguish
letters and numbers from other characters. . You can edit the contents of the array in one of the character set XML files to specify that '-' is a “letter.” Then use the given character set for your FULLTEXT indexes. For information about the array format, see Section 10.12.1, “Character Definition Arrays”.
Add a new collation for the character set used by the indexed columns, and alter the columns to use that collation. For general
information about adding collations, see Section 10.13, “Adding a Collation to a Character Set”. For an example specific to full-text indexing, see Section 12.9.7, “Adding a Collation for Full-Text Indexing”.