Когда я запускаю следующее
MATCH(my_text) AGAINST ('"hey"' IN BOOLEAN MODE)
Я получаю результаты для всех строк, содержащих hey
Когда я запускаю следующее
MATCH(my_text) AGAINST ('"n=3"' IN BOOLEAN MODE)
Я не получаю результатов, хотя есть 2 строки, содержащие n=3
В таблице есть
Индекс 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”.
Я думаю, проблема здесь в том, что
=
не рассматривается как допустимый символ для слова. Итак, в полнотекстовом указателе нет"n=3"
. См. этот ТАК вопрос для обсуждения и возможного исправления.