<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="fulltext-fine-tuning">
      </a>
      14.9.6 Fine-Tuning MySQL Full-Text Search
     </h3>
    </div>
   </div>
  </div>
  <p>
   MySQL's full-text search capability has few user-tunable
        parameters. You can exert more control over full-text searching
        behavior if you have a MySQL source distribution because some
        changes require source code modifications. See
   <a class="xref" href="source-installation.html" title="2.8 Installing MySQL from Source">
    Section 2.8, “Installing MySQL from Source”
   </a>
   .
  </p>
  <p>
   Full-text search is carefully tuned for effectiveness. Modifying
        the default behavior in most cases can actually decrease
        effectiveness.
   <span class="emphasis">
    <em>
     Do not alter the MySQL sources unless
        you know what you are doing
    </em>
   </span>
   .
  </p>
  <p>
   Most full-text variables described in this section must be set
        at server startup time. A server restart is required to change
        them; they cannot be modified while the server is running.
  </p>
  <p>
   Some variable changes require that you rebuild the
   <code class="literal">
    FULLTEXT
   </code>
   indexes in your tables. Instructions
        for doing so are given later in this section.
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="fulltext-fine-tuning.html#fulltext-word-length" title="Configuring Minimum and Maximum Word Length">
       Configuring Minimum and Maximum Word Length
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="fulltext-fine-tuning.html#fulltext-natural-language-threshold" title="Configuring the Natural Language Search Threshold">
       Configuring the Natural Language Search Threshold
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="fulltext-fine-tuning.html#fulltext-modify-boolean-operators" title="Modifying Boolean Full-Text Search Operators">
       Modifying Boolean Full-Text Search Operators
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="fulltext-fine-tuning.html#fulltext-modify-character-set" title="Character Set Modifications">
       Character Set Modifications
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="fulltext-fine-tuning.html#fulltext-rebuild-innodb-indexes" title="Rebuilding InnoDB Full-Text Indexes">
       Rebuilding InnoDB Full-Text Indexes
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="fulltext-fine-tuning.html#fulltext-optimize" title="Optimizing InnoDB Full-Text Indexes">
       Optimizing InnoDB Full-Text Indexes
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="fulltext-fine-tuning.html#fulltext-rebuild-myisam-indexes" title="Rebuilding MyISAM Full-Text Indexes">
       Rebuilding MyISAM Full-Text Indexes
      </a>
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="fulltext-word-length">
       </a>
       Configuring Minimum and Maximum Word Length
      </h4>
     </div>
    </div>
   </div>
   <p>
    The minimum and maximum lengths of words to be indexed are
          defined by the
    <a class="link" href="innodb-parameters.html#sysvar_innodb_ft_min_token_size">
     <code class="literal">
      innodb_ft_min_token_size
     </code>
    </a>
    and
    <a class="link" href="innodb-parameters.html#sysvar_innodb_ft_max_token_size">
     <code class="literal">
      innodb_ft_max_token_size
     </code>
    </a>
    for
    <code class="literal">
     InnoDB
    </code>
    search indexes, and
    <a class="link" href="server-system-variables.html#sysvar_ft_min_word_len">
     <code class="literal">
      ft_min_word_len
     </code>
    </a>
    and
    <a class="link" href="server-system-variables.html#sysvar_ft_max_word_len">
     <code class="literal">
      ft_max_word_len
     </code>
    </a>
    for
    <code class="literal">
     MyISAM
    </code>
    ones.
   </p>
   <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
    <div class="admon-title">
     Note
    </div>
    <p>
     Minimum and maximum word length full-text parameters do not
            apply to
     <code class="literal">
      FULLTEXT
     </code>
     indexes created using
            the ngram parser. ngram token size is defined by the
     <a class="link" href="server-system-variables.html#sysvar_ngram_token_size">
      <code class="literal">
       ngram_token_size
      </code>
     </a>
     option.
    </p>
   </div>
   <p>
    After changing any of these options, rebuild your
    <code class="literal">
     FULLTEXT
    </code>
    indexes for the change to take
          effect. For example, to make two-character words searchable,
          you could put the following lines in an option file:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-ini"><div class="docs-select-all right" id="sa84008437"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">innodb_ft_min_token_size</span><span class="token attr-value"><span class="token punctuation">=</span>2</span>
<span class="token constant">ft_min_word_len</span><span class="token attr-value"><span class="token punctuation">=</span>2</span></code></pre>
   </div>
   <p>
    Then restart the server and rebuild your
    <code class="literal">
     FULLTEXT
    </code>
    indexes. For
    <code class="literal">
     MyISAM
    </code>
    tables, note the remarks regarding
    <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
     <span class="command">
      <strong>
       myisamchk
      </strong>
     </span>
    </a>
    in the instructions that follow
          for rebuilding
    <code class="literal">
     MyISAM
    </code>
    full-text indexes.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="fulltext-natural-language-threshold">
       </a>
       Configuring the Natural Language Search Threshold
      </h4>
     </div>
    </div>
   </div>
   <p>
    For
    <code class="literal">
     MyISAM
    </code>
    search indexes, the 50%
          threshold for natural language searches is determined by the
          particular weighting scheme chosen. To disable it, look for
          the following line in
    <code class="filename">
     storage/myisam/ftdefs.h
    </code>
    :
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-c"><div class="docs-select-all right" id="sa94197938"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-c"><span class="token macro property">#<span class="token directive keyword">define</span> GWS_IN_USE GWS_PROB</span></code></pre>
   </div>
   <p>
    Change that line to this:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-c"><div class="docs-select-all right" id="sa22025074"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-c"><span class="token macro property">#<span class="token directive keyword">define</span> GWS_IN_USE GWS_FREQ</span></code></pre>
   </div>
   <p>
    Then recompile MySQL. There is no need to rebuild the indexes
          in this case.
   </p>
   <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
    <div class="admon-title">
     Note
    </div>
    <p>
     By making this change, you
     <span class="emphasis">
      <em>
       severely
      </em>
     </span>
     decrease MySQL's ability to provide adequate relevance
            values for the
     <a class="link" href="fulltext-search.html#function_match">
      <code class="literal">
       MATCH()
      </code>
     </a>
     function. If you really need to search for such common
            words, it would be better to search using
     <code class="literal">
      IN
            BOOLEAN MODE
     </code>
     instead, which does not observe the
            50% threshold.
    </p>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="fulltext-modify-boolean-operators">
       </a>
       Modifying Boolean Full-Text Search Operators
      </h4>
     </div>
    </div>
   </div>
   <p>
    To change the operators used for boolean full-text searches on
    <code class="literal">
     MyISAM
    </code>
    tables, set the
    <a class="link" href="server-system-variables.html#sysvar_ft_boolean_syntax">
     <code class="literal">
      ft_boolean_syntax
     </code>
    </a>
    system
          variable. (
    <code class="literal">
     InnoDB
    </code>
    does not have an
          equivalent setting.) This variable can be changed while the
          server is running, but you must have privileges sufficient to
          set global system variables (see
    <a class="xref" href="system-variable-privileges.html" title="7.1.9.1 System Variable Privileges">
     Section 7.1.9.1, “System Variable Privileges”
    </a>
    ). No rebuilding
          of indexes is necessary in this case.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="fulltext-modify-character-set">
       </a>
       Character Set Modifications
      </h4>
     </div>
    </div>
   </div>
   <p>
    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
    <code class="literal">
     FULLTEXT
    </code>
    indexes. Suppose that you want
          to treat the hyphen character ('-') as a word character. Use
          one of these methods:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       Modify the MySQL source: In
       <code class="filename">
        storage/innobase/handler/ha_innodb.cc
       </code>
       (for
       <code class="literal">
        InnoDB
       </code>
       ), or in
       <code class="filename">
        storage/myisam/ftdefs.h
       </code>
       (for
       <code class="literal">
        MyISAM
       </code>
       ), see the
       <code class="literal">
        true_word_char()
       </code>
       and
       <code class="literal">
        misc_word_char()
       </code>
       macros. Add
       <code class="literal">
        '-'
       </code>
       to one of those macros and
              recompile MySQL.
      </p>
     </li>
     <li class="listitem">
      <p>
       Modify a character set file: This requires no
              recompilation. The
       <code class="literal">
        true_word_char()
       </code>
       macro uses a
       <span class="quote">
        “
        <span class="quote">
         character type
        </span>
        ”
       </span>
       table to
              distinguish letters and numbers from other characters. .
              You can edit the contents of the
       <code class="literal">
        &lt;ctype&gt;&lt;map&gt;
       </code>
       array in one
              of the character set XML files to specify that
       <code class="literal">
        '-'
       </code>
       is a
       <span class="quote">
        “
        <span class="quote">
         letter.
        </span>
        ”
       </span>
       Then
              use the given character set for your
       <code class="literal">
        FULLTEXT
       </code>
       indexes. For information about
              the
       <code class="literal">
        &lt;ctype&gt;&lt;map&gt;
       </code>
       array
              format, see
       <a class="xref" href="character-arrays.html" title="12.13.1 Character Definition Arrays">
        Section 12.13.1, “Character Definition Arrays”
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       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
       <a class="xref" href="adding-collation.html" title="12.14 Adding a Collation to a Character Set">
        Section 12.14, “Adding a Collation to a Character Set”
       </a>
       . For an
              example specific to full-text indexing, see
       <a class="xref" href="full-text-adding-collation.html" title="14.9.7 Adding a User-Defined Collation for Full-Text Indexing">
        Section 14.9.7, “Adding a User-Defined Collation for Full-Text Indexing”
       </a>
       .
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="fulltext-rebuild-innodb-indexes">
       </a>
       Rebuilding InnoDB Full-Text Indexes
      </h4>
     </div>
    </div>
   </div>
   <p>
    For the changes to take effect,
    <code class="literal">
     FULLTEXT
    </code>
    indexes must be rebuilt after modifying any of the following
          full-text index variables:
    <a class="link" href="innodb-parameters.html#sysvar_innodb_ft_min_token_size">
     <code class="literal">
      innodb_ft_min_token_size
     </code>
    </a>
    ;
    <a class="link" href="innodb-parameters.html#sysvar_innodb_ft_max_token_size">
     <code class="literal">
      innodb_ft_max_token_size
     </code>
    </a>
    ;
    <a class="link" href="innodb-parameters.html#sysvar_innodb_ft_server_stopword_table">
     <code class="literal">
      innodb_ft_server_stopword_table
     </code>
    </a>
    ;
    <a class="link" href="innodb-parameters.html#sysvar_innodb_ft_user_stopword_table">
     <code class="literal">
      innodb_ft_user_stopword_table
     </code>
    </a>
    ;
    <a class="link" href="innodb-parameters.html#sysvar_innodb_ft_enable_stopword">
     <code class="literal">
      innodb_ft_enable_stopword
     </code>
    </a>
    ;
    <a class="link" href="server-system-variables.html#sysvar_ngram_token_size">
     <code class="literal">
      ngram_token_size
     </code>
    </a>
    . Modifying
    <a class="link" href="innodb-parameters.html#sysvar_innodb_ft_min_token_size">
     <code class="literal">
      innodb_ft_min_token_size
     </code>
    </a>
    ,
    <a class="link" href="innodb-parameters.html#sysvar_innodb_ft_max_token_size">
     <code class="literal">
      innodb_ft_max_token_size
     </code>
    </a>
    , or
    <a class="link" href="server-system-variables.html#sysvar_ngram_token_size">
     <code class="literal">
      ngram_token_size
     </code>
    </a>
    requires
          restarting the server.
   </p>
   <p>
    To rebuild
    <code class="literal">
     FULLTEXT
    </code>
    indexes for an
    <code class="literal">
     InnoDB
    </code>
    table, use
    <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
     <code class="literal">
      ALTER TABLE
     </code>
    </a>
    with the
    <code class="literal">
     DROP INDEX
    </code>
    and
    <code class="literal">
     ADD INDEX
    </code>
    options to drop and re-create each index.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="fulltext-optimize">
       </a>
       Optimizing InnoDB Full-Text Indexes
      </h4>
     </div>
    </div>
   </div>
   <p>
    Running
    <a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
     <code class="literal">
      OPTIMIZE TABLE
     </code>
    </a>
    on a
          table with a full-text index rebuilds the full-text index,
          removing deleted Document IDs and consolidating multiple
          entries for the same word, where possible.
   </p>
   <p>
    To optimize a full-text index, enable
    <a class="link" href="innodb-parameters.html#sysvar_innodb_optimize_fulltext_only">
     <code class="literal">
      innodb_optimize_fulltext_only
     </code>
    </a>
    and run
    <code class="literal">
     OPTIMIZE TABLE
    </code>
    .
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99712482"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">set</span> <span class="token keyword">GLOBAL</span> innodb_optimize_fulltext_only<span class="token operator">=</span><span class="token keyword">ON</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">OPTIMIZE</span> <span class="token keyword">TABLE</span> opening_lines<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Table              <span class="token punctuation">|</span> Op       <span class="token punctuation">|</span> Msg_type <span class="token punctuation">|</span> Msg_text <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> test.opening_lines <span class="token punctuation">|</span> optimize <span class="token punctuation">|</span> status   <span class="token punctuation">|</span> OK       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.01 sec)</span></code></pre>
   </div>
   <p>
    To avoid lengthy rebuild times for full-text indexes on large
          tables, you can use the
    <a class="link" href="innodb-parameters.html#sysvar_innodb_ft_num_word_optimize">
     <code class="literal">
      innodb_ft_num_word_optimize
     </code>
    </a>
    option to perform the optimization in stages. The
    <code class="literal">
     innodb_ft_num_word_optimize
    </code>
    option defines
          the number of words that are optimized each time
    <a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
     <code class="literal">
      OPTIMIZE TABLE
     </code>
    </a>
    is run. The
          default setting is 2000, which means that 2000 words are
          optimized each time
    <a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
     <code class="literal">
      OPTIMIZE
          TABLE
     </code>
    </a>
    is run. Subsequent
    <a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
     <code class="literal">
      OPTIMIZE TABLE
     </code>
    </a>
    operations
          continue from where the preceding
    <a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
     <code class="literal">
      OPTIMIZE TABLE
     </code>
    </a>
    operation ended.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="fulltext-rebuild-myisam-indexes">
       </a>
       Rebuilding MyISAM Full-Text Indexes
      </h4>
     </div>
    </div>
   </div>
   <p>
    If you modify full-text variables that affect indexing
          (
    <a class="link" href="server-system-variables.html#sysvar_ft_min_word_len">
     <code class="literal">
      ft_min_word_len
     </code>
    </a>
    ,
    <a class="link" href="server-system-variables.html#sysvar_ft_max_word_len">
     <code class="literal">
      ft_max_word_len
     </code>
    </a>
    , or
    <a class="link" href="server-system-variables.html#sysvar_ft_stopword_file">
     <code class="literal">
      ft_stopword_file
     </code>
    </a>
    ), or if you
          change the stopword file itself, you must rebuild your
    <code class="literal">
     FULLTEXT
    </code>
    indexes after making the changes
          and restarting the server.
   </p>
   <p>
    To rebuild the
    <code class="literal">
     FULLTEXT
    </code>
    indexes for a
    <code class="literal">
     MyISAM
    </code>
    table, it is sufficient to do a
    <code class="literal">
     QUICK
    </code>
    repair operation:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa45201918"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">REPAIR</span> <span class="token keyword">TABLE</span> <em class="replaceable">tbl_name</em> <span class="token keyword">QUICK</span><span class="token punctuation">;</span></code></pre>
   </div>
   <p>
    Alternatively, use
    <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
     <code class="literal">
      ALTER TABLE
     </code>
    </a>
    as just described. In some cases, this may be faster than a
          repair operation.
   </p>
   <p>
    Each table that contains any
    <code class="literal">
     FULLTEXT
    </code>
    index
          must be repaired as just shown. Otherwise, queries for the
          table may yield incorrect results, and modifications to the
          table causes the server to see the table as corrupt and in
          need of repair.
   </p>
   <p>
    If you use
    <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
     <span class="command">
      <strong>
       myisamchk
      </strong>
     </span>
    </a>
    to perform an
          operation that modifies
    <code class="literal">
     MyISAM
    </code>
    table
          indexes (such as repair or analyze), the
    <code class="literal">
     FULLTEXT
    </code>
    indexes are rebuilt using the
    <span class="emphasis">
     <em>
      default
     </em>
    </span>
    full-text parameter values for
          minimum word length, maximum word length, and stopword file
          unless you specify otherwise. This can result in queries
          failing.
   </p>
   <p>
    The problem occurs because these parameters are known only by
          the server. They are not stored in
    <code class="literal">
     MyISAM
    </code>
    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
    <a class="link" href="server-system-variables.html#sysvar_ft_min_word_len">
     <code class="literal">
      ft_min_word_len
     </code>
    </a>
    ,
    <a class="link" href="server-system-variables.html#sysvar_ft_max_word_len">
     <code class="literal">
      ft_max_word_len
     </code>
    </a>
    , and
    <a class="link" href="server-system-variables.html#sysvar_ft_stopword_file">
     <code class="literal">
      ft_stopword_file
     </code>
    </a>
    values for
    <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
     <span class="command">
      <strong>
       myisamchk
      </strong>
     </span>
    </a>
    that you use for
    <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
     <span class="command">
      <strong>
       mysqld
      </strong>
     </span>
    </a>
    . For example, if you have set the
          minimum word length to 3, you can repair a table with
    <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
     <span class="command">
      <strong>
       myisamchk
      </strong>
     </span>
    </a>
    like this:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa71417168"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">myisamchk <span class="token property">--recover</span> <span class="token constant">--ft_min_word_len</span><span class="token attr-value"><span class="token punctuation">=</span>3</span> <em class="replaceable">tbl_name</em><span class="token punctuation">.</span>MYI</code></pre>
   </div>
   <p>
    To ensure that
    <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
     <span class="command">
      <strong>
       myisamchk
      </strong>
     </span>
    </a>
    and the server use
          the same values for full-text parameters, place each one in
          both the
    <code class="literal">
     [mysqld]
    </code>
    and
    <code class="literal">
     [myisamchk]
    </code>
    sections of an option file:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-ini"><div class="docs-select-all right" id="sa84431483"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">ft_min_word_len</span><span class="token attr-value"><span class="token punctuation">=</span>3</span>

<span class="token selector">[myisamchk]</span>
<span class="token constant">ft_min_word_len</span><span class="token attr-value"><span class="token punctuation">=</span>3</span></code></pre>
   </div>
   <p>
    An alternative to using
    <a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
     <span class="command">
      <strong>
       myisamchk
      </strong>
     </span>
    </a>
    for
    <code class="literal">
     MyISAM
    </code>
    table index modification is to use
          the
    <a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
     <code class="literal">
      REPAIR TABLE
     </code>
    </a>
    ,
    <a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
     <code class="literal">
      ANALYZE TABLE
     </code>
    </a>
    ,
    <a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
     <code class="literal">
      OPTIMIZE TABLE
     </code>
    </a>
    , or
    <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
     <code class="literal">
      ALTER TABLE
     </code>
    </a>
    statements. These
          statements are performed by the server, which knows the proper
          full-text parameter values to use.
   </p>
  </div>
 </div>
 <br/>
</div>
