![background image](http://html1.mh-extra.com/html/oracle/5-0/5-0_reference-manual_1646196966.webp)
Adding a Collation for Full-Text Indexing
946
• 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.4, “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”
.
If you modify full-text variables that affect indexing (
ft_min_word_len
[452]
,
ft_max_word_len
[452]
, or
ft_stopword_file
[453]
), or if you change the stopword file itself, you
must rebuild your
FULLTEXT
indexes after making the changes and restarting the server. To rebuild
the indexes in this case, it is sufficient to do a
QUICK
repair operation:
mysql>
REPAIR TABLE tbl_name QUICK;
Alternatively, use
ALTER TABLE
with the
DROP INDEX
and
ADD INDEX
options to drop and re-create
each
FULLTEXT
index. In some cases, this may be faster than a repair operation.
Each table that contains any
FULLTEXT
index must be repaired as just shown. Otherwise, queries for
the table may yield incorrect results, and modifications to the table will cause the server to see the table
as corrupt and in need of repair.
Note that if you use
myisamchk
to perform an operation that modifies table indexes (such as repair or
analyze), the
FULLTEXT
indexes are rebuilt using the default full-text parameter values for minimum
word length, maximum word length, and stopword file unless you specify otherwise. This can result in
queries failing.
The problem occurs because these parameters are known only by the server. They are not stored
in
MyISAM
index files. To avoid the problem if you have modified the minimum or maximum word
length or stopword file values used by the server, specify the same
ft_min_word_len
[452]
,
ft_max_word_len
[452]
, and
ft_stopword_file
[453]
values for
myisamchk
that you use for
mysqld
. For example, if you have set the minimum word length to 3, you can repair a table with
myisamchk
like this:
shell>
myisamchk --recover --ft_min_word_len=3 tbl_name.MYI
To ensure that
myisamchk
and the server use the same values for full-text parameters, place each
one in both the
[mysqld]
and
[myisamchk]
sections of an option file:
[mysqld]
ft_min_word_len=3
[myisamchk]
ft_min_word_len=3
An alternative to using
myisamchk
for index modification is to use the
REPAIR TABLE
,
ANALYZE
TABLE
,
OPTIMIZE TABLE
, or
ALTER TABLE
statements. These statements are performed by the
server, which knows the proper full-text parameter values to use.
12.9.7. Adding a Collation for Full-Text Indexing
This section describes how to add a new collation for full-text searches. The sample collation is like
latin1_swedish_ci
but treats the
'-'
character as a letter rather than as a punctuation character
so that it can be indexed as a word character. General information about adding collations is given
in
Section 10.4, “Adding a Collation to a Character Set”
; it is assumed that you have read it and are
familiar with the files involved.
To add a collation for full-text indexing, use this procedure:
1. Add a collation to the
Index.xml
file. The collation ID must be unused, so choose a value different
from 62 if that ID is already taken on your system.
<charset name="latin1">
...
<collation name="latin1_fulltext_ci" id="62"/>
Содержание 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 ...