再my.conf加入下列參數,可分別將stopword關掉與min length設成1
以下為MyISAM
ft_min_word_len=1
ft_stopword_file=''
以下為InnoDB
innodb_ft_min_token_size=1
innodb_ft_server_stopword_table = ''
innodb_ft_enable_stopword=FALSE
官方說明
ft_min_word_len
The minimum length of the word to be included in a
FULLTEXT
index.
Note
:
FULLTEXT
indexes must be rebuilt after
changing this variable. Use
REPAIR TABLE
tbl_name
QUICK
.
ft_stopword_file
The file from which to read the list of stopwords for
full-text searches. The server looks for the file in the data
directory unless an absolute path name is given to specify a
different directory. All the words from the file are used;
comments are
not honored. By default, a
built-in list of stopwords is used (as defined in the
storage/myisam/ft_static.c
file). Setting
this variable to the empty string (
''
)
disables stopword filtering. See also
Section 12.9.4, “Full-Text Stopwords”.
Note
:
FULLTEXT
indexes must be rebuilt after
changing this variable or the contents of the stopword file.
Use
REPAIR TABLE
tbl_name
QUICK
.
innodb_ft_min_token_size
Minimum length of words that are stored in an InnoDB
FULLTEXT
index. Increasing this value
reduces the size of the index, thus speeding up queries, by
omitting common word that are unlikely to be significant in a
search context, such as the English words
“a” and
“to”. For content using a CJK (Chinese, Japanese,
Korean) character set, specify a value of 1.
innodb_ft_server_stopword_table
Name of the table containing a list of words to ignore when
creating an InnoDB
FULLTEXT
index, in the
format
db_name
/table_name
.
Note:
The stopword table must be an
InnoDB
table, containing a single
VARCHAR
column
named
VALUE
. The stopword table must
exist before you specify its name in the configuration
option value.
innodb_ft_enable_stopword
Specifies that a set of
stopwords is associated
with an
InnoDB
FULLTEXT
index at the time the index is created. If the
innodb_ft_user_stopword_table
option is set, the stopwords are taken from that table. Else,
if the
innodb_ft_server_stopword_table
option is set, the stopwords are taken from that table.
Otherwise, a built-in set of default stopwords is used.