<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="fulltext-boolean">
      </a>
      14.9.2 Boolean Full-Text Searches
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045201825488">
  </a>
  <a class="indexterm" name="idm46045201824448">
  </a>
  <p>
   MySQL can perform boolean full-text searches using the
   <code class="literal">
    IN BOOLEAN MODE
   </code>
   modifier. With this modifier,
        certain characters have special meaning at the beginning or end
        of words in the search string. In the following query, the
   <code class="literal">
    +
   </code>
   and
   <code class="literal">
    -
   </code>
   operators indicate
        that a word must be present or absent, respectively, for a match
        to occur. Thus, the query retrieves all the rows that contain
        the word
   <span class="quote">
    “
    <span class="quote">
     MySQL
    </span>
    ”
   </span>
   but that do
   <span class="emphasis">
    <em>
     not
    </em>
   </span>
   contain the word
   <span class="quote">
    “
    <span class="quote">
     YourSQL
    </span>
    ”
   </span>
   :
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88474055"><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">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> articles <span class="token keyword">WHERE</span> <span class="token operator">MATCH</span> <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span>
<span class="token prompt">    -&gt;</span> <span class="token keyword">AGAINST</span> <span class="token punctuation">(</span><span class="token string">'+MySQL -YourSQL'</span> <span class="token keyword">IN</span> <span class="token datatype">BOOLEAN</span> <span class="token keyword">MODE</span><span class="token punctuation">)</span><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 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> id <span class="token punctuation">|</span> title                 <span class="token punctuation">|</span> body                                <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 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>  1 <span class="token punctuation">|</span> MySQL Tutorial        <span class="token punctuation">|</span> DBMS stands for DataBase ...        <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  2 <span class="token punctuation">|</span> How To Use MySQL Well <span class="token punctuation">|</span> After you went through a ...        <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  3 <span class="token punctuation">|</span> Optimizing MySQL      <span class="token punctuation">|</span> In this tutorial, we show ...       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  4 <span class="token punctuation">|</span> 1001 MySQL Tricks     <span class="token punctuation">|</span> 1. Never run mysqld as root. 2. ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  6 <span class="token punctuation">|</span> MySQL Security        <span class="token punctuation">|</span> When configured properly, MySQL ... <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 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></code></pre>
  </div>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    In implementing this feature, MySQL uses what is sometimes
          referred to as
    <span class="firstterm">
     implied Boolean
          logic
    </span>
    , in which
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       <code class="literal">
        +
       </code>
       stands for
       <code class="literal">
        AND
       </code>
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        -
       </code>
       stands for
       <code class="literal">
        NOT
       </code>
      </p>
     </li>
     <li class="listitem">
      <p>
       [
       <span class="emphasis">
        <em>
         no operator
        </em>
       </span>
       ] implies
       <code class="literal">
        OR
       </code>
      </p>
     </li>
    </ul>
   </div>
  </div>
  <p>
   Boolean full-text searches have these characteristics:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      They do not automatically sort rows in order of decreasing
            relevance.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       InnoDB
      </code>
      tables require a
      <code class="literal">
       FULLTEXT
      </code>
      index on all columns of the
      <a class="link" href="fulltext-search.html#function_match">
       <code class="literal">
        MATCH()
       </code>
      </a>
      expression to perform
            boolean queries. Boolean queries against a
      <code class="literal">
       MyISAM
      </code>
      search index can work even without
            a
      <code class="literal">
       FULLTEXT
      </code>
      index, although a search
            executed in this fashion would be quite slow.
     </p>
    </li>
    <li class="listitem">
     <p>
      The minimum and maximum word length full-text parameters
            apply to
      <code class="literal">
       FULLTEXT
      </code>
      indexes created using
            the built-in
      <code class="literal">
       FULLTEXT
      </code>
      parser and MeCab
            parser plugin.
      <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>
      are used for
      <code class="literal">
       InnoDB
      </code>
      search indexes.
      <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>
      are used
            for
      <code class="literal">
       MyISAM
      </code>
      search indexes.
     </p>
     <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>
    </li>
    <li class="listitem">
     <p>
      The stopword list applies, controlled by
      <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="innodb-parameters.html#sysvar_innodb_ft_server_stopword_table">
       <code class="literal">
        innodb_ft_server_stopword_table
       </code>
      </a>
      ,
            and
      <a class="link" href="innodb-parameters.html#sysvar_innodb_ft_user_stopword_table">
       <code class="literal">
        innodb_ft_user_stopword_table
       </code>
      </a>
      for
      <code class="literal">
       InnoDB
      </code>
      search indexes, and
      <a class="link" href="server-system-variables.html#sysvar_ft_stopword_file">
       <code class="literal">
        ft_stopword_file
       </code>
      </a>
      for
      <code class="literal">
       MyISAM
      </code>
      ones.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       InnoDB
      </code>
      full-text search does not support
            the use of multiple operators on a single search word, as in
            this example:
      <code class="literal">
       '++apple'
      </code>
      . Use of multiple
            operators on a single search word returns a syntax error to
            standard out. MyISAM full-text search successfully processes
            the same search, ignoring all operators except for the
            operator immediately adjacent to the search word.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       InnoDB
      </code>
      full-text search only supports
            leading plus or minus signs. For example,
      <code class="literal">
       InnoDB
      </code>
      supports
      <code class="literal">
       '+apple'
      </code>
      but does not support
      <code class="literal">
       'apple+'
      </code>
      . Specifying a trailing plus or
            minus sign causes
      <code class="literal">
       InnoDB
      </code>
      to report a
            syntax error.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       InnoDB
      </code>
      full-text search does not support
            the use of a leading plus sign with wildcard
            (
      <code class="literal">
       '+*'
      </code>
      ), a plus and minus sign combination
            (
      <code class="literal">
       '+-'
      </code>
      ), or leading a plus and minus sign
            combination (
      <code class="literal">
       '+-apple'
      </code>
      ). These invalid
            queries return a syntax error.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       InnoDB
      </code>
      full-text search does not support
            the use of the
      <code class="literal">
       @
      </code>
      symbol in boolean
            full-text searches. The
      <code class="literal">
       @
      </code>
      symbol is
            reserved for use by the
      <code class="literal">
       @distance
      </code>
      proximity search operator.
     </p>
    </li>
    <li class="listitem">
     <p>
      They do not use the 50% threshold that applies to
      <code class="literal">
       MyISAM
      </code>
      search indexes.
     </p>
    </li>
   </ul>
  </div>
  <p>
   The boolean full-text search capability supports the following
        operators:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       +
      </code>
     </p>
     <p>
      A leading or trailing plus sign indicates that this word
      <span class="emphasis">
       <em>
        must
       </em>
      </span>
      be present in each row that is
            returned.
      <code class="literal">
       InnoDB
      </code>
      only supports leading
            plus signs.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       -
      </code>
     </p>
     <p>
      A leading or trailing minus sign indicates that this word
            must
      <span class="emphasis">
       <em>
        not
       </em>
      </span>
      be present in any of the rows
            that are returned.
      <code class="literal">
       InnoDB
      </code>
      only supports
            leading minus signs.
     </p>
     <p>
      Note: The
      <code class="literal">
       -
      </code>
      operator acts only to exclude
            rows that are otherwise matched by other search terms. Thus,
            a boolean-mode search that contains only terms preceded by
      <code class="literal">
       -
      </code>
      returns an empty result. It does not
            return
      <span class="quote">
       “
       <span class="quote">
        all rows except those containing any of the
            excluded terms.
       </span>
       ”
      </span>
     </p>
    </li>
    <li class="listitem">
     <p>
      (no operator)
     </p>
     <p>
      By default (when neither
      <code class="literal">
       +
      </code>
      nor
      <code class="literal">
       -
      </code>
      is specified), the word is optional,
            but the rows that contain it are rated higher. This mimics
            the behavior of
      <a class="link" href="fulltext-search.html#function_match">
       <code class="literal">
        MATCH()
            AGAINST()
       </code>
      </a>
      without the
      <code class="literal">
       IN BOOLEAN
            MODE
      </code>
      modifier.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       @
       <em class="replaceable">
        <code>
         distance
        </code>
       </em>
      </code>
     </p>
     <p>
      This operator works on
      <code class="literal">
       InnoDB
      </code>
      tables
            only. It tests whether two or more words all start within a
            specified distance from each other, measured in words.
            Specify the search words within a double-quoted string
            immediately before the
      <code class="literal">
       @
       <em class="replaceable">
        <code>
         distance
        </code>
       </em>
      </code>
      operator, for example,
      <code class="literal">
       MATCH(col1) AGAINST('"word1
            word2 word3" @8' IN BOOLEAN MODE)
      </code>
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       &gt; &lt;
      </code>
     </p>
     <p>
      These two operators are used to change a word's contribution
            to the relevance value that is assigned to a row. The
      <code class="literal">
       &gt;
      </code>
      operator increases the contribution
            and the
      <code class="literal">
       &lt;
      </code>
      operator decreases it. See
            the example following this list.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       ( )
      </code>
     </p>
     <p>
      Parentheses group words into subexpressions. Parenthesized
            groups can be nested.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       ~
      </code>
     </p>
     <p>
      A leading tilde acts as a negation operator, causing the
            word's contribution to the row's relevance to be negative.
            This is useful for marking
      <span class="quote">
       “
       <span class="quote">
        noise
       </span>
       ”
      </span>
      words. A row
            containing such a word is rated lower than others, but is
            not excluded altogether, as it would be with the
      <code class="literal">
       -
      </code>
      operator.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       *
      </code>
     </p>
     <p>
      The asterisk serves as the truncation (or wildcard)
            operator. Unlike the other operators, it is
      <span class="emphasis">
       <em>
        appended
       </em>
      </span>
      to the word to be affected.
            Words match if they begin with the word preceding the
      <code class="literal">
       *
      </code>
      operator.
     </p>
     <p>
      If a word is specified with the truncation operator, it is
            not stripped from a boolean query, even if it is too short
            or a stopword. Whether a word is too short is determined
            from the
      <a class="link" href="innodb-parameters.html#sysvar_innodb_ft_min_token_size">
       <code class="literal">
        innodb_ft_min_token_size
       </code>
      </a>
      setting for
      <code class="literal">
       InnoDB
      </code>
      tables, or
      <a class="link" href="server-system-variables.html#sysvar_ft_min_word_len">
       <code class="literal">
        ft_min_word_len
       </code>
      </a>
      for
      <code class="literal">
       MyISAM
      </code>
      tables. These options are not
            applicable to
      <code class="literal">
       FULLTEXT
      </code>
      indexes that use
            the ngram parser.
     </p>
     <p>
      The wildcarded word is considered as a prefix that must be
            present at the start of one or more words. If the minimum
            word length is 4, a search for
      <code class="literal">
       '+
       <em class="replaceable">
        <code>
         word
        </code>
       </em>
       +the*'
      </code>
      could return fewer rows than a search for
      <code class="literal">
       '+
       <em class="replaceable">
        <code>
         word
        </code>
       </em>
       +the'
      </code>
      ,
            because the second query ignores the too-short search term
      <code class="literal">
       the
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       "
      </code>
     </p>
     <p>
      A phrase that is enclosed within double quote
            (
      <code class="literal">
       "
      </code>
      ) characters matches only rows that
            contain the phrase
      <span class="emphasis">
       <em>
        literally, as it was
            typed
       </em>
      </span>
      . The full-text engine splits the phrase
            into words and performs a search in the
      <code class="literal">
       FULLTEXT
      </code>
      index for the words. Nonword
            characters need not be matched exactly: Phrase searching
            requires only that matches contain exactly the same words as
            the phrase and in the same order. For example,
      <code class="literal">
       "test phrase"
      </code>
      matches
      <code class="literal">
       "test,
            phrase"
      </code>
      .
     </p>
     <p>
      If the phrase contains no words that are in the index, the
            result is empty. The words might not be in the index because
            of a combination of factors: if they do not exist in the
            text, are stopwords, or are shorter than the minimum length
            of indexed words.
     </p>
    </li>
   </ul>
  </div>
  <p>
   The following examples demonstrate some search strings that use
        boolean full-text operators:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       'apple banana'
      </code>
     </p>
     <p>
      Find rows that contain at least one of the two words.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       '+apple +juice'
      </code>
     </p>
     <p>
      Find rows that contain both words.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       '+apple macintosh'
      </code>
     </p>
     <p>
      Find rows that contain the word
      <span class="quote">
       “
       <span class="quote">
        apple
       </span>
       ”
      </span>
      , but
            rank rows higher if they also contain
      <span class="quote">
       “
       <span class="quote">
        macintosh
       </span>
       ”
      </span>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       '+apple -macintosh'
      </code>
     </p>
     <p>
      Find rows that contain the word
      <span class="quote">
       “
       <span class="quote">
        apple
       </span>
       ”
      </span>
      but not
      <span class="quote">
       “
       <span class="quote">
        macintosh
       </span>
       ”
      </span>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       '+apple ~macintosh'
      </code>
     </p>
     <p>
      Find rows that contain the word
      <span class="quote">
       “
       <span class="quote">
        apple
       </span>
       ”
      </span>
      , but if
            the row also contains the word
      <span class="quote">
       “
       <span class="quote">
        macintosh
       </span>
       ”
      </span>
      ,
            rate it lower than if row does not. This is
      <span class="quote">
       “
       <span class="quote">
        softer
       </span>
       ”
      </span>
      than a search for
      <code class="literal">
       '+apple
            -macintosh'
      </code>
      , for which the presence of
      <span class="quote">
       “
       <span class="quote">
        macintosh
       </span>
       ”
      </span>
      causes the row not to be returned
            at all.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       '+apple +(&gt;turnover &lt;strudel)'
      </code>
     </p>
     <p>
      Find rows that contain the words
      <span class="quote">
       “
       <span class="quote">
        apple
       </span>
       ”
      </span>
      and
      <span class="quote">
       “
       <span class="quote">
        turnover
       </span>
       ”
      </span>
      , or
      <span class="quote">
       “
       <span class="quote">
        apple
       </span>
       ”
      </span>
      and
      <span class="quote">
       “
       <span class="quote">
        strudel
       </span>
       ”
      </span>
      (in any order), but rank
      <span class="quote">
       “
       <span class="quote">
        apple
            turnover
       </span>
       ”
      </span>
      higher than
      <span class="quote">
       “
       <span class="quote">
        apple strudel
       </span>
       ”
      </span>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       'apple*'
      </code>
     </p>
     <p>
      Find rows that contain words such as
      <span class="quote">
       “
       <span class="quote">
        apple
       </span>
       ”
      </span>
      ,
      <span class="quote">
       “
       <span class="quote">
        apples
       </span>
       ”
      </span>
      ,
      <span class="quote">
       “
       <span class="quote">
        applesauce
       </span>
       ”
      </span>
      , or
      <span class="quote">
       “
       <span class="quote">
        applet
       </span>
       ”
      </span>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       '"some words"'
      </code>
     </p>
     <p>
      Find rows that contain the exact phrase
      <span class="quote">
       “
       <span class="quote">
        some
            words
       </span>
       ”
      </span>
      (for example, rows that contain
      <span class="quote">
       “
       <span class="quote">
        some
            words of wisdom
       </span>
       ”
      </span>
      but not
      <span class="quote">
       “
       <span class="quote">
        some noise
            words
       </span>
       ”
      </span>
      ). Note that the
      <code class="literal">
       "
      </code>
      characters that enclose the phrase are operator characters
            that delimit the phrase. They are not the quotation marks
            that enclose the search string itself.
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="fulltext-boolean-innodb-relevancy-ranking">
       </a>
       Relevancy Rankings for InnoDB Boolean Mode Search
      </h4>
     </div>
    </div>
   </div>
   <p>
    <a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
     <code class="literal">
      InnoDB
     </code>
    </a>
    full-text search is
          modeled on the
    <a class="ulink" href="http://sphinxsearch.com/" target="_blank">
     Sphinx
    </a>
    full-text
          search engine, and the algorithms used are based on
    <a class="ulink" href="http://en.wikipedia.org/wiki/Okapi_BM25" target="_blank">
     BM25
    </a>
    and
    <a class="ulink" href="http://en.wikipedia.org/wiki/TF-IDF" target="_blank">
     TF-IDF
    </a>
    ranking algorithms. For these reasons, relevancy rankings for
    <code class="literal">
     InnoDB
    </code>
    boolean full-text search may differ
          from
    <a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
     <code class="literal">
      MyISAM
     </code>
    </a>
    relevancy rankings.
   </p>
   <p>
    <code class="literal">
     InnoDB
    </code>
    uses a variation of the
    <span class="quote">
     “
     <span class="quote">
      term
          frequency-inverse document frequency
     </span>
     ”
    </span>
    (
    <code class="literal">
     TF-IDF
    </code>
    ) weighting system to rank a
          document's relevance for a given full-text search query. The
    <code class="literal">
     TF-IDF
    </code>
    weighting is based on how frequently
          a word appears in a document, offset by how frequently the
          word appears in all documents in the collection. In other
          words, the more frequently a word appears in a document, and
          the less frequently the word appears in the document
          collection, the higher the document is ranked.
   </p>
   <h5>
    <a name="idm46045201678384">
    </a>
    How Relevancy Ranking is Calculated
   </h5>
   <p>
    The term frequency (
    <code class="literal">
     TF
    </code>
    ) value is the number
          of times that a word appears in a document. The inverse
          document frequency (
    <code class="literal">
     IDF
    </code>
    ) value of a word is
          calculated using the following formula, where
    <code class="literal">
     total_records
    </code>
    is the number of records in
          the collection, and
    <code class="literal">
     matching_records
    </code>
    is the
          number of records that the search term appears in.
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa33355922"><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-simple">$<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">=</span> log10<span class="token punctuation">(</span> $<span class="token punctuation">{</span>total_records<span class="token punctuation">}</span> <span class="token operator">/</span> $<span class="token punctuation">{</span>matching_records<span class="token punctuation">}</span> <span class="token punctuation">)</span></code></pre>
   </div>
   <p>
    When a document contains a word multiple times, the IDF value
          is multiplied by the TF value:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa62291994"><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-simple">$<span class="token punctuation">{</span>TF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span></code></pre>
   </div>
   <p>
    Using the
    <code class="literal">
     TF
    </code>
    and
    <code class="literal">
     IDF
    </code>
    values, the relevancy ranking for a document is calculated
          using this formula:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa12196992"><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-simple">$<span class="token punctuation">{</span>rank<span class="token punctuation">}</span> <span class="token operator">=</span> $<span class="token punctuation">{</span>TF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span></code></pre>
   </div>
   <p>
    The formula is demonstrated in the following examples.
   </p>
   <h5>
    <a name="idm46045201668208">
    </a>
    Relevancy Ranking for a Single Word Search
   </h5>
   <p>
    This example demonstrates the relevancy ranking calculation
          for a single-word search.
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa52177525"><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">CREATE</span> <span class="token keyword">TABLE</span> articles <span class="token punctuation">(</span>
<span class="token prompt">    -&gt;</span>   id <span class="token datatype">INT</span> <span class="token keyword">UNSIGNED</span> <span class="token keyword">AUTO_INCREMENT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   title <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">200</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   body <span class="token datatype">TEXT</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   <span class="token keyword">FULLTEXT</span> <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span>
<span class="token prompt">    -&gt;</span><span class="token punctuation">)</span>  <span class="token keyword">ENGINE</span><span class="token operator">=</span>InnoDB<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (1.04 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> articles <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span> <span class="token keyword">VALUES</span>
<span class="token prompt">    -&gt;</span>   <span class="token punctuation">(</span><span class="token string">'MySQL Tutorial'</span><span class="token punctuation">,</span><span class="token string">'This database tutorial ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   <span class="token punctuation">(</span><span class="token string">"How To Use MySQL"</span><span class="token punctuation">,</span><span class="token string">'After you went through a ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   <span class="token punctuation">(</span><span class="token string">'Optimizing Your Database'</span><span class="token punctuation">,</span><span class="token string">'In this database tutorial ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   <span class="token punctuation">(</span><span class="token string">'MySQL vs. YourSQL'</span><span class="token punctuation">,</span><span class="token string">'When comparing databases ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   <span class="token punctuation">(</span><span class="token string">'MySQL Security'</span><span class="token punctuation">,</span><span class="token string">'When configured properly, MySQL ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   <span class="token punctuation">(</span><span class="token string">'Database, Database, Database'</span><span class="token punctuation">,</span><span class="token string">'database database database'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   <span class="token punctuation">(</span><span class="token string">'1001 MySQL Tricks'</span><span class="token punctuation">,</span><span class="token string">'1. Never run mysqld as root. 2. ...'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   <span class="token punctuation">(</span><span class="token string">'MySQL Full-Text Indexes'</span><span class="token punctuation">,</span> <span class="token string">'MySQL fulltext indexes use a ..'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 8 rows affected (0.06 sec)</span>
<span class="token output">Records: 8  Duplicates: 0  Warnings: 0</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> id<span class="token punctuation">,</span> title<span class="token punctuation">,</span> body<span class="token punctuation">,</span> 
<span class="token prompt">    -&gt;</span>   <span class="token operator">MATCH</span> <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span> <span class="token keyword">AGAINST</span> <span class="token punctuation">(</span><span class="token string">'database'</span> <span class="token keyword">IN</span> <span class="token datatype">BOOLEAN</span> <span class="token keyword">MODE</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> score
<span class="token prompt">    -&gt;</span>   <span class="token keyword">FROM</span> articles <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> score <span class="token keyword">DESC</span><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 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> id <span class="token punctuation">|</span> title                        <span class="token punctuation">|</span> body                                <span class="token punctuation">|</span> score               <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 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>  6 <span class="token punctuation">|</span> Database, Database, Database <span class="token punctuation">|</span> database database database          <span class="token punctuation">|</span>  1.0886961221694946 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  3 <span class="token punctuation">|</span> Optimizing Your Database     <span class="token punctuation">|</span> In this database tutorial ...       <span class="token punctuation">|</span> 0.36289870738983154 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  1 <span class="token punctuation">|</span> MySQL Tutorial               <span class="token punctuation">|</span> This database tutorial ...          <span class="token punctuation">|</span> 0.18144935369491577 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  2 <span class="token punctuation">|</span> How To Use MySQL             <span class="token punctuation">|</span> After you went through a ...        <span class="token punctuation">|</span>                   0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  4 <span class="token punctuation">|</span> MySQL vs. YourSQL            <span class="token punctuation">|</span> When comparing databases ...        <span class="token punctuation">|</span>                   0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  5 <span class="token punctuation">|</span> MySQL Security               <span class="token punctuation">|</span> When configured properly, MySQL ... <span class="token punctuation">|</span>                   0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  7 <span class="token punctuation">|</span> 1001 MySQL Tricks            <span class="token punctuation">|</span> 1. Never run mysqld as root. 2. ... <span class="token punctuation">|</span>                   0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  8 <span class="token punctuation">|</span> MySQL Full<span class="token punctuation">-</span>Text Indexes      <span class="token punctuation">|</span> MySQL fulltext indexes use a ..     <span class="token punctuation">|</span>                   0 <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 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">8 rows in set (0.00 sec)</span></code></pre>
   </div>
   <p>
    There are 8 records in total, with 3 that match the
    <span class="quote">
     “
     <span class="quote">
      database
     </span>
     ”
    </span>
    search term. The first record
          (
    <code class="literal">
     id 6
    </code>
    ) contains the search term 6 times and
          has a relevancy ranking of
    <code class="literal">
     1.0886961221694946
    </code>
    . This ranking value is
          calculated using a
    <code class="literal">
     TF
    </code>
    value of 6 (the
    <span class="quote">
     “
     <span class="quote">
      database
     </span>
     ”
    </span>
    search term appears 6 times in record
    <code class="literal">
     id 6
    </code>
    ) and an
    <code class="literal">
     IDF
    </code>
    value
          of 0.42596873216370745, which is calculated as follows (where
          8 is the total number of records and 3 is the number of
          records that the search term appears in):
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa28453778"><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-simple">$<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">=</span> LOG10<span class="token punctuation">(</span> 8 <span class="token operator">/</span> 3 <span class="token punctuation">)</span> <span class="token operator">=</span> 0<span class="token punctuation">.</span>42596873216370745</code></pre>
   </div>
   <p>
    The
    <code class="literal">
     TF
    </code>
    and
    <code class="literal">
     IDF
    </code>
    values
          are then entered into the ranking formula:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa52453593"><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-simple">$<span class="token punctuation">{</span>rank<span class="token punctuation">}</span> <span class="token operator">=</span> $<span class="token punctuation">{</span>TF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span></code></pre>
   </div>
   <p>
    Performing the calculation in the MySQL command-line client
          returns a ranking value of 1.088696164686938.
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20759166"><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">SELECT</span> <span class="token number">6</span><span class="token operator">*</span><span class="token function">LOG10</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token operator">/</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token function">LOG10</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token operator">/</span><span class="token number">3</span><span class="token punctuation">)</span><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>
<span class="token output"><span class="token punctuation">|</span> 6*LOG10(8/3)*LOG10(8/3) <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>
<span class="token output"><span class="token punctuation">|</span>       1.088696164686938 <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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
   </div>
   <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
    <div class="admon-title">
     Note
    </div>
    <p>
     You may notice a slight difference in the ranking values
            returned by the
     <code class="literal">
      SELECT ... MATCH ...
            AGAINST
     </code>
     statement and the MySQL command-line
            client (
     <code class="literal">
      1.0886961221694946
     </code>
     versus
     <code class="literal">
      1.088696164686938
     </code>
     ). The difference is due
            to how the casts between integers and floats/doubles are
            performed internally by
     <code class="literal">
      InnoDB
     </code>
     (along
            with related precision and rounding decisions), and how they
            are performed elsewhere, such as in the MySQL command-line
            client or other types of calculators.
    </p>
   </div>
   <h5>
    <a name="idm46045201635600">
    </a>
    Relevancy Ranking for a Multiple Word Search
   </h5>
   <p>
    This example demonstrates the relevancy ranking calculation
          for a multiple-word full-text search based on the
    <code class="literal">
     articles
    </code>
    table and data used in the
          previous example.
   </p>
   <p>
    If you search on more than one word, the relevancy ranking
          value is a sum of the relevancy ranking value for each word,
          as shown in this formula:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa89555483"><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-simple">$<span class="token punctuation">{</span>rank<span class="token punctuation">}</span> <span class="token operator">=</span> $<span class="token punctuation">{</span>TF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">+</span> $<span class="token punctuation">{</span>TF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span> <span class="token operator">*</span> $<span class="token punctuation">{</span>IDF<span class="token punctuation">}</span></code></pre>
   </div>
   <p>
    Performing a search on two terms ('mysql tutorial') returns
          the following results:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93739978"><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">SELECT</span> id<span class="token punctuation">,</span> title<span class="token punctuation">,</span> body<span class="token punctuation">,</span> <span class="token operator">MATCH</span> <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span>  
<span class="token prompt">    -&gt;</span>   <span class="token keyword">AGAINST</span> <span class="token punctuation">(</span><span class="token string">'mysql tutorial'</span> <span class="token keyword">IN</span> <span class="token datatype">BOOLEAN</span> <span class="token keyword">MODE</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> score
<span class="token prompt">    -&gt;</span>   <span class="token keyword">FROM</span> articles <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> score <span class="token keyword">DESC</span><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 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> id <span class="token punctuation">|</span> title                        <span class="token punctuation">|</span> body                                <span class="token punctuation">|</span> score                <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 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>  1 <span class="token punctuation">|</span> MySQL Tutorial               <span class="token punctuation">|</span> This database tutorial ...          <span class="token punctuation">|</span>   0.7405621409416199 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  3 <span class="token punctuation">|</span> Optimizing Your Database     <span class="token punctuation">|</span> In this database tutorial ...       <span class="token punctuation">|</span>   0.3624762296676636 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  5 <span class="token punctuation">|</span> MySQL Security               <span class="token punctuation">|</span> When configured properly, MySQL ... <span class="token punctuation">|</span> 0.031219376251101494 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  8 <span class="token punctuation">|</span> MySQL Full<span class="token punctuation">-</span>Text Indexes      <span class="token punctuation">|</span> MySQL fulltext indexes use a ..     <span class="token punctuation">|</span> 0.031219376251101494 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  2 <span class="token punctuation">|</span> How To Use MySQL             <span class="token punctuation">|</span> After you went through a ...        <span class="token punctuation">|</span> 0.015609688125550747 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  4 <span class="token punctuation">|</span> MySQL vs. YourSQL            <span class="token punctuation">|</span> When comparing databases ...        <span class="token punctuation">|</span> 0.015609688125550747 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  7 <span class="token punctuation">|</span> 1001 MySQL Tricks            <span class="token punctuation">|</span> 1. Never run mysqld as root. 2. ... <span class="token punctuation">|</span> 0.015609688125550747 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  6 <span class="token punctuation">|</span> Database, Database, Database <span class="token punctuation">|</span> database database database          <span class="token punctuation">|</span>                    0 <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 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">8 rows in set (0.00 sec)</span></code></pre>
   </div>
   <p>
    In the first record (
    <code class="literal">
     id 8
    </code>
    ), 'mysql' appears
          once and 'tutorial' appears twice. There are six matching
          records for 'mysql' and two matching records for 'tutorial'.
          The MySQL command-line client returns the expected ranking
          value when inserting these values into the ranking formula for
          a multiple word search:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18617036"><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">SELECT</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token operator">*</span><span class="token function">log10</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token operator">/</span><span class="token number">6</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token function">log10</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token operator">/</span><span class="token number">6</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token operator">*</span><span class="token function">log10</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token operator">/</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token function">log10</span><span class="token punctuation">(</span><span class="token number">8</span><span class="token operator">/</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">)</span><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 class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> (1*log10(8/6)*log10(8/6)) <span class="token punctuation">+</span> (2*log10(8/2)*log10(8/2)) <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 class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>                                    0.7405621541938003 <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 class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
   </div>
   <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
    <div class="admon-title">
     Note
    </div>
    <p>
     The slight difference in the ranking values returned by the
     <code class="literal">
      SELECT ... MATCH ... AGAINST
     </code>
     statement
            and the MySQL command-line client is explained in the
            preceding example.
    </p>
   </div>
  </div>
 </div>
 <br/>
</div>
