Sophie

Sophie

distrib > Fedora > 18 > x86_64 > media > updates > by-pkgid > e450e7f3d6075c4a54de19e68d38177f > files > 268

groonga-doc-3.0.5-1.fc18.x86_64.rpm


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>8.3.25. suggest &mdash; groonga v3.0.5 documentation</title>
    
    <link rel="stylesheet" href="../../_static/groonga.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '3.0.5',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
    <link rel="top" title="groonga v3.0.5 documentation" href="../../index.html" />
    <link rel="up" title="8.3. Command" href="../command.html" />
    <link rel="next" title="8.3.26. table_create" href="table_create.html" />
    <link rel="prev" title="8.3.24. status" href="status.html" /> 
  </head>
  <body>
<div class="header">
  <h1 class="title">
    <a id="top-link" href="../../index.html">
      <span class="project">groonga</span>
      <span class="separator">-</span>
      <span class="description">An open-source fulltext search engine and column store.</span>
    </a>
  </h1>

  <div class="other-language-links">
    <ul>
      <li><a href="../../../../ja/html/reference/commands/suggest.html"><img src="../../_static/jp.png" alt="日本語">日本語版はこちら</a></li>
    </ul>
  </div>
</div>
  

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="table_create.html" title="8.3.26. table_create"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="status.html" title="8.3.24. status"
             accesskey="P">previous</a> |</li>
        <li><a href="../../index.html">groonga v3.0.5 documentation</a> &raquo;</li>
          <li><a href="../../reference.html" >8. リファレンスマニュアル</a> &raquo;</li>
          <li><a href="../command.html" accesskey="U">8.3. Command</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="suggest">
<h1>8.3.25. suggest<a class="headerlink" href="#suggest" title="Permalink to this headline">¶</a></h1>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The suggest feature specification isn't stable. The
specification may be changed.</p>
</div>
<div class="section" id="name">
<h2>8.3.25.1. NAME<a class="headerlink" href="#name" title="Permalink to this headline">¶</a></h2>
<p>suggest - returns completion, correction and/or suggestion for a query.</p>
</div>
<div class="section" id="synopsis">
<h2>8.3.25.2. SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline">¶</a></h2>
<div class="highlight-none"><div class="highlight"><pre>suggest types table column query [sortby [output_columns [offset [limit [frequency_threshold [conditional_probability_threshold [prefix_search]]]]]]]
</pre></div>
</div>
</div>
<div class="section" id="description">
<h2>8.3.25.3. DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h2>
<p>The suggest command returns completion, correction and/or
suggestion for a specified query.</p>
<p>See <a class="reference internal" href="../../suggest/introduction.html"><em>Introduction</em></a> about completion,
correction and suggestion.</p>
</div>
<div class="section" id="options">
<h2>8.3.25.4. OPTIONS<a class="headerlink" href="#options" title="Permalink to this headline">¶</a></h2>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">types</span></tt></dt>
<dd><p class="first">It specifies what types are returned by the suggest
command.</p>
<p>Here are available types:</p>
<blockquote>
<div><dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">complete</span></tt></dt>
<dd>The suggest command does completion.</dd>
<dt><tt class="docutils literal"><span class="pre">correct</span></tt></dt>
<dd>The suggest command does correction.</dd>
<dt><tt class="docutils literal"><span class="pre">suggest</span></tt></dt>
<dd>The suggest command does suggestion.</dd>
</dl>
</div></blockquote>
<p>You can specify one or more types separated by <tt class="docutils literal"><span class="pre">|</span></tt>.
Here are examples:</p>
<blockquote class="last">
<div><p>It returns correction:</p>
<div class="highlight-none"><div class="highlight"><pre>correct
</pre></div>
</div>
<p>It returns correction and suggestion:</p>
<div class="highlight-none"><div class="highlight"><pre>correct|suggest
</pre></div>
</div>
<p>It returns complete, correction and suggestion:</p>
<div class="highlight-none"><div class="highlight"><pre>complete|correct|suggest
</pre></div>
</div>
</div></blockquote>
</dd>
<dt><tt class="docutils literal"><span class="pre">table</span></tt></dt>
<dd><p class="first">It specifies table name that has <tt class="docutils literal"><span class="pre">item_${DATA_SET_NAME}</span></tt> format.
For example, <tt class="docutils literal"><span class="pre">item_query</span></tt> is a table name if you created
dataset by the following command:</p>
<div class="last highlight-none"><div class="highlight"><pre>groonga-suggest-create-dataset /tmp/db-path query
</pre></div>
</div>
</dd>
<dt><tt class="docutils literal"><span class="pre">column</span></tt></dt>
<dd>It specifies a column name that has furigana in
Katakana in <tt class="docutils literal"><span class="pre">table</span></tt> table.</dd>
<dt><tt class="docutils literal"><span class="pre">query</span></tt></dt>
<dd>It specifies query for completion, correction and/or
suggestion.</dd>
<dt><tt class="docutils literal"><span class="pre">sortby</span></tt></dt>
<dd><p class="first">It specifies sort key.</p>
<dl class="last docutils">
<dt>Default:</dt>
<dd><tt class="docutils literal"><span class="pre">-_score</span></tt></dd>
</dl>
</dd>
<dt><tt class="docutils literal"><span class="pre">output_columns</span></tt></dt>
<dd><p class="first">It specifies output columns.</p>
<dl class="last docutils">
<dt>Default:</dt>
<dd><tt class="docutils literal"><span class="pre">_key,_score</span></tt></dd>
</dl>
</dd>
<dt><tt class="docutils literal"><span class="pre">offset</span></tt></dt>
<dd><p class="first">It specifies returned records offset.</p>
<dl class="last docutils">
<dt>Default:</dt>
<dd><tt class="docutils literal"><span class="pre">0</span></tt></dd>
</dl>
</dd>
<dt><tt class="docutils literal"><span class="pre">limit</span></tt></dt>
<dd><p class="first">It specifies number of returned records.</p>
<dl class="last docutils">
<dt>Default:</dt>
<dd><tt class="docutils literal"><span class="pre">10</span></tt></dd>
</dl>
</dd>
<dt><tt class="docutils literal"><span class="pre">frequency_threshold</span></tt></dt>
<dd><p class="first">It specifies threshold for item frequency. Returned records must have
<tt class="docutils literal"><span class="pre">_score</span></tt> that is greater than or equal to <tt class="docutils literal"><span class="pre">frequency_threshold</span></tt>.</p>
<dl class="last docutils">
<dt>Default:</dt>
<dd><tt class="docutils literal"><span class="pre">100</span></tt></dd>
</dl>
</dd>
</dl>
<p><tt class="docutils literal"><span class="pre">conditional_probability_threshold</span></tt></p>
<blockquote>
<div><p>It specifies threshold for conditional
probability. Conditional probability is used for learned
data. It is probability of query submission when <tt class="docutils literal"><span class="pre">query</span></tt>
is occurred. Returned records must have conditional
probability that is greater than or equal to
<tt class="docutils literal"><span class="pre">conditional_probability_threshold</span></tt>.</p>
<dl class="docutils">
<dt>Default:</dt>
<dd><tt class="docutils literal"><span class="pre">0.2</span></tt></dd>
</dl>
</div></blockquote>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">prefix_search</span></tt></dt>
<dd><p class="first">It specifies whether optional prefix search is used or not
in completion.</p>
<p>Here are available values:</p>
<blockquote>
<div><dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">yes</span></tt></dt>
<dd>Prefix search is always used.</dd>
<dt><tt class="docutils literal"><span class="pre">no</span></tt></dt>
<dd>Prefix search is never used.</dd>
<dt><tt class="docutils literal"><span class="pre">auto</span></tt></dt>
<dd>Prefix search is used only when other search can't
find any records.</dd>
</dl>
</div></blockquote>
<dl class="last docutils">
<dt>Default:</dt>
<dd><tt class="docutils literal"><span class="pre">auto</span></tt></dd>
</dl>
</dd>
<dt><tt class="docutils literal"><span class="pre">similar_search</span></tt></dt>
<dd><p class="first">It specifies whether optional similar search is used or not
in correction.</p>
<p>Here are available values:</p>
<blockquote>
<div><dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">yes</span></tt></dt>
<dd>Similar search is always used.</dd>
<dt><tt class="docutils literal"><span class="pre">no</span></tt></dt>
<dd>Similar search is never used.</dd>
<dt><tt class="docutils literal"><span class="pre">auto</span></tt></dt>
<dd>Similar search is used only when other search can't
find any records.</dd>
</dl>
</div></blockquote>
<dl class="last docutils">
<dt>Default:</dt>
<dd><tt class="docutils literal"><span class="pre">auto</span></tt></dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="return-value">
<h2>8.3.25.5. RETURN VALUE<a class="headerlink" href="#return-value" title="Permalink to this headline">¶</a></h2>
<div class="section" id="json-format">
<h3>8.3.25.5.1. JSON format<a class="headerlink" href="#json-format" title="Permalink to this headline">¶</a></h3>
<p>Here is a returned JSON format:</p>
<div class="highlight-none"><div class="highlight"><pre>{&quot;type1&quot;: [[&quot;candidate1&quot;, score of candidate1],
           [&quot;candidate2&quot;, score of candidate2],
           ...],
 &quot;type2&quot;: [[&quot;candidate1&quot;, score of candidate1],
           [&quot;candidate2&quot;, score of candidate2],
           ...],
 ...}
</pre></div>
</div>
<p><tt class="docutils literal"><span class="pre">type</span></tt></p>
<blockquote>
<div>A type specified by <tt class="docutils literal"><span class="pre">types</span></tt>.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">candidate</span></tt></p>
<blockquote>
<div>A candidate for completion, correction or suggestion.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">score</span> <span class="pre">of</span> <span class="pre">candidate</span></tt></p>
<blockquote>
<div>A score of corresponding <tt class="docutils literal"><span class="pre">candidate</span></tt>. It means that
higher score candidate is more likely candidate for
completion, correction or suggestion. Returned candidates
are sorted by <tt class="docutils literal"><span class="pre">score</span> <span class="pre">of</span> <span class="pre">candidate</span></tt> descending by
default.</div></blockquote>
</div>
</div>
<div class="section" id="example">
<h2>8.3.25.6. EXAMPLE<a class="headerlink" href="#example" title="Permalink to this headline">¶</a></h2>
<p>Here are learned data for completion.</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>load --table event_query --each &#39;suggest_preparer(_id, type, item, sequence, time, pair_query)&#39;
[
{&quot;sequence&quot;: &quot;1&quot;, &quot;time&quot;: 1312950803.86057, &quot;item&quot;: &quot;e&quot;},
{&quot;sequence&quot;: &quot;1&quot;, &quot;time&quot;: 1312950803.96857, &quot;item&quot;: &quot;en&quot;},
{&quot;sequence&quot;: &quot;1&quot;, &quot;time&quot;: 1312950804.26057, &quot;item&quot;: &quot;eng&quot;},
{&quot;sequence&quot;: &quot;1&quot;, &quot;time&quot;: 1312950804.56057, &quot;item&quot;: &quot;engi&quot;},
{&quot;sequence&quot;: &quot;1&quot;, &quot;time&quot;: 1312950804.76057, &quot;item&quot;: &quot;engin&quot;},
{&quot;sequence&quot;: &quot;1&quot;, &quot;time&quot;: 1312950805.86057, &quot;item&quot;: &quot;engine&quot;, &quot;type&quot;: &quot;submit&quot;}
]
# [[0, 1337566253.89858, 0.000355720520019531], 6]
</pre></div>
</div>
<p>Here are learned data for correction.</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>load --table event_query --each &#39;suggest_preparer(_id, type, item, sequence, time, pair_query)&#39;
[
{&quot;sequence&quot;: &quot;2&quot;, &quot;time&quot;: 1312950803.86057, &quot;item&quot;: &quot;s&quot;},
{&quot;sequence&quot;: &quot;2&quot;, &quot;time&quot;: 1312950803.96857, &quot;item&quot;: &quot;sa&quot;},
{&quot;sequence&quot;: &quot;2&quot;, &quot;time&quot;: 1312950804.26057, &quot;item&quot;: &quot;sae&quot;},
{&quot;sequence&quot;: &quot;2&quot;, &quot;time&quot;: 1312950804.56057, &quot;item&quot;: &quot;saer&quot;},
{&quot;sequence&quot;: &quot;2&quot;, &quot;time&quot;: 1312950804.76057, &quot;item&quot;: &quot;saerc&quot;},
{&quot;sequence&quot;: &quot;2&quot;, &quot;time&quot;: 1312950805.76057, &quot;item&quot;: &quot;saerch&quot;, &quot;type&quot;: &quot;submit&quot;},
{&quot;sequence&quot;: &quot;2&quot;, &quot;time&quot;: 1312950809.76057, &quot;item&quot;: &quot;serch&quot;},
{&quot;sequence&quot;: &quot;2&quot;, &quot;time&quot;: 1312950810.86057, &quot;item&quot;: &quot;search&quot;, &quot;type&quot;: &quot;submit&quot;}
]
# [[0, 1337566253.89858, 0.000355720520019531], 8]
</pre></div>
</div>
<p>Here are learned data for suggestion.</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>load --table event_query --each &#39;suggest_preparer(_id, type, item, sequence, time, pair_query)&#39;
[
{&quot;sequence&quot;: &quot;3&quot;, &quot;time&quot;: 1312950803.86057, &quot;item&quot;: &quot;search engine&quot;, &quot;type&quot;: &quot;submit&quot;},
{&quot;sequence&quot;: &quot;3&quot;, &quot;time&quot;: 1312950808.86057, &quot;item&quot;: &quot;web search realtime&quot;, &quot;type&quot;: &quot;submit&quot;}
]
# [[0, 1337566253.89858, 0.000355720520019531], 2]
</pre></div>
</div>
<p>Here is a completion example.</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>suggest --table item_query --column kana --types complete --frequency_threshold 1 --query en
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   {
#     &quot;complete&quot;: [
#       [
#         1
#       ],
#       [
#         [
#           &quot;_key&quot;,
#           &quot;ShortText&quot;
#         ],
#         [
#           &quot;_score&quot;,
#           &quot;Int32&quot;
#         ]
#       ],
#       [
#         &quot;engine&quot;,
#         1
#       ]
#     ]
#   }
# ]
</pre></div>
</div>
<p>Here is a correction example.</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>suggest --table item_query --column kana --types correct --frequency_threshold 1 --query saerch
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   {
#     &quot;correct&quot;: [
#       [
#         1
#       ],
#       [
#         [
#           &quot;_key&quot;,
#           &quot;ShortText&quot;
#         ],
#         [
#           &quot;_score&quot;,
#           &quot;Int32&quot;
#         ]
#       ],
#       [
#         &quot;search&quot;,
#         1
#       ]
#     ]
#   }
# ]
</pre></div>
</div>
<p>Here is a suggestion example.</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>suggest --table item_query --column kana --types suggest --frequency_threshold 1 --query search
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   {
#     &quot;suggest&quot;: [
#       [
#         2
#       ],
#       [
#         [
#           &quot;_key&quot;,
#           &quot;ShortText&quot;
#         ],
#         [
#           &quot;_score&quot;,
#           &quot;Int32&quot;
#         ]
#       ],
#       [
#         &quot;search engine&quot;,
#         1
#       ],
#       [
#         &quot;web search realtime&quot;,
#         1
#       ]
#     ]
#   }
# ]
</pre></div>
</div>
<p>Here is a mixed example.</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>suggest --table item_query --column kana --types complete|correct|suggest --frequency_threshold 1 --query search
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   {
#     &quot;suggest&quot;: [
#       [
#         2
#       ],
#       [
#         [
#           &quot;_key&quot;,
#           &quot;ShortText&quot;
#         ],
#         [
#           &quot;_score&quot;,
#           &quot;Int32&quot;
#         ]
#       ],
#       [
#         &quot;search engine&quot;,
#         1
#       ],
#       [
#         &quot;web search realtime&quot;,
#         1
#       ]
#     ],
#     &quot;complete&quot;: [
#       [
#         2
#       ],
#       [
#         [
#           &quot;_key&quot;,
#           &quot;ShortText&quot;
#         ],
#         [
#           &quot;_score&quot;,
#           &quot;Int32&quot;
#         ]
#       ],
#       [
#         &quot;search&quot;,
#         2
#       ],
#       [
#         &quot;search engine&quot;,
#         2
#       ]
#     ],
#     &quot;correct&quot;: [
#       [
#         1
#       ],
#       [
#         [
#           &quot;_key&quot;,
#           &quot;ShortText&quot;
#         ],
#         [
#           &quot;_score&quot;,
#           &quot;Int32&quot;
#         ]
#       ],
#       [
#         &quot;search&quot;,
#         2
#       ]
#     ]
#   }
# ]
</pre></div>
</div>
</div>
<div class="section" id="see-also">
<h2>8.3.25.7. SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><a class="reference internal" href="../../suggest.html"><em>Suggest</em></a></li>
<li><a class="reference internal" href="../executables/groonga-suggest-create-dataset.html"><em>groonga-suggest-create-dataset</em></a></li>
</ul>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">8.3.25. suggest</a><ul>
<li><a class="reference internal" href="#name">8.3.25.1. NAME</a></li>
<li><a class="reference internal" href="#synopsis">8.3.25.2. SYNOPSIS</a></li>
<li><a class="reference internal" href="#description">8.3.25.3. DESCRIPTION</a></li>
<li><a class="reference internal" href="#options">8.3.25.4. OPTIONS</a></li>
<li><a class="reference internal" href="#return-value">8.3.25.5. RETURN VALUE</a><ul>
<li><a class="reference internal" href="#json-format">8.3.25.5.1. JSON format</a></li>
</ul>
</li>
<li><a class="reference internal" href="#example">8.3.25.6. EXAMPLE</a></li>
<li><a class="reference internal" href="#see-also">8.3.25.7. SEE ALSO</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="status.html"
                        title="previous chapter">8.3.24. status</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="table_create.html"
                        title="next chapter">8.3.26. <tt class="docutils literal"><span class="pre">table_create</span></tt></a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/reference/commands/suggest.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="table_create.html" title="8.3.26. table_create"
             >next</a> |</li>
        <li class="right" >
          <a href="status.html" title="8.3.24. status"
             >previous</a> |</li>
        <li><a href="../../index.html">groonga v3.0.5 documentation</a> &raquo;</li>
          <li><a href="../../reference.html" >8. リファレンスマニュアル</a> &raquo;</li>
          <li><a href="../command.html" >8.3. Command</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2009-2013, Brazil, Inc.
    </div>
  </body>
</html>