Fine-Tuning MySQL Full-Text Search
945
• The minimum and maximum lengths of words to be indexed are defined by the
ft_min_word_len
[452]
and
ft_max_word_len
[452]
system variables. (See
Section 5.1.4,
“Server System Variables”
.) The default minimum value is four characters; the default
maximum is version dependent. If you change either value, you must rebuild your
FULLTEXT
indexes. For example, if you want three-character words to be searchable, you can set the
ft_min_word_len
[452]
variable by putting the following lines in an option file:
[mysqld]
ft_min_word_len=3
Then restart the server and rebuild your
FULLTEXT
indexes. Note particularly the remarks regarding
myisamchk
in the instructions following this list.
• To override the default stopword list, set the
ft_stopword_file
[453]
system variable. (See
Section 5.1.4, “Server System Variables”
.) The variable value should be the path name of the file
containing the stopword list, or the empty string to disable stopword filtering. The server looks for the
file in the data directory unless an absolute path name is given to specify a different directory. After
changing the value of this variable or the contents of the stopword file, restart the server and rebuild
your
FULLTEXT
indexes.
The stopword list is free-form. That is, you may use any nonalphanumeric character such as newline,
space, or comma to separate stopwords. Exceptions are the underscore character (“
_
”) and a single
apostrophe (“
'
”) which are treated as part of a word. The character set of the stopword list is the
server's default character set; see
Section 10.1.3.1, “Server Character Set and Collation”
.
• The 50% threshold for natural language searches is determined by the particular weighting scheme
chosen. To disable it, look for the following line in
myisam/ftdefs.h
:
#define GWS_IN_USE GWS_PROB
Change that line to this:
#define GWS_IN_USE GWS_FREQ
Then recompile MySQL. There is no need to rebuild the indexes in this case.
Note
By making this change, you severely decrease MySQL's ability to provide
adequate relevance values for the
MATCH()
[934]
function. If you really
need to search for such common words, it would be better to search using
IN
BOOLEAN MODE
instead, which does not observe the 50% threshold.
• To change the operators used for boolean full-text searches, set the
ft_boolean_syntax
[451]
system variable. This variable can be changed while the server is running, but you must have the
SUPER
[578]
privilege to do so. No rebuilding of indexes is necessary in this case. See
Section 5.1.4,
“Server System Variables”
, which describes the rules governing how to set this variable.
• If you want to change the set of characters that are considered word characters, you can do so in
several ways, as described in the following list. After making the modification, you must 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
myisam/ftdefs.h
, 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
<ctype><map>
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
<ctype><map>
array format, see
Section 10.3.1, “Character Definition Arrays”
.
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...