Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 03663abacfb5829946c324cb3e985338 > files > 220

groonga-doc-1.2.7-1.fc14.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>5.5. Suggestion &mdash; groonga v1.2.6 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:     '1.2.6',
        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 v1.2.6 documentation" href="../index.html" />
    <link rel="up" title="5. Suggest" href="../suggest.html" />
    <link rel="next" title="6. Geolocation Search" href="../geolocation_search.html" />
    <link rel="prev" title="5.4. Correction" href="correction.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/suggest/suggestion.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="../geolocation_search.html" title="6. Geolocation Search"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="correction.html" title="5.4. Correction"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">groonga v1.2.6 documentation</a> &raquo;</li>
          <li><a href="../suggest.html" accesskey="U">5. Suggest</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="suggestion">
<h1>5.5. Suggestion<a class="headerlink" href="#suggestion" title="Permalink to this headline">¶</a></h1>
<p>This section describes about the following completion
features:</p>
<ul class="simple">
<li>How it works</li>
<li>How to use</li>
<li>How to learn</li>
</ul>
<div class="section" id="how-it-works">
<h2>5.5.1. How it works<a class="headerlink" href="#how-it-works" title="Permalink to this headline">¶</a></h2>
<p>The suggestion feature uses a search to compute suggested
words:</p>
<blockquote>
<div><ol class="arabic simple">
<li>Cooccurrence search against learned data.</li>
</ol>
</div></blockquote>
<div class="section" id="cooccurrence-search">
<h3>5.5.1.1. Cooccurrence search<a class="headerlink" href="#cooccurrence-search" title="Permalink to this headline">¶</a></h3>
<p>Cooccurrence search can find related words from user's
input. It uses user submissions that will be learned
from query logs, access logs and so on.</p>
<p>For example, there are the following user submissions:</p>
<table border="1" class="docutils">
<colgroup>
<col width="100%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">query</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>search engine</td>
</tr>
<tr class="row-odd"><td>web search realtime</td>
</tr>
</tbody>
</table>
<p>Groonga creates the following suggestion pairs:</p>
<table border="1" class="docutils">
<colgroup>
<col width="22%" />
<col width="78%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">input</th>
<th class="head">suggested words</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>search</td>
<td>search engine</td>
</tr>
<tr class="row-odd"><td>engine</td>
<td>search engine</td>
</tr>
<tr class="row-even"><td>web</td>
<td>web search realtime</td>
</tr>
<tr class="row-odd"><td>search</td>
<td>web search realtime</td>
</tr>
<tr class="row-even"><td>realtime</td>
<td>web search realtime</td>
</tr>
</tbody>
</table>
<p>Those pairs are created by the following steps:</p>
<blockquote>
<div><ol class="arabic simple">
<li>Tokenizes user input query by TokenDelimit tokenizer
that uses a space as token delimiter. (e.g. &quot;search
engine&quot; is tokenized to two tokens &quot;search&quot; and
&quot;engine&quot;.)</li>
<li>Creates a pair that is consists of a token and original
query for each token.</li>
</ol>
</div></blockquote>
<p>If an user inputs &quot;search&quot; and cooccurrence search returns
&quot;search engine&quot; and &quot;web search realtime&quot; because &quot;search&quot; is
in two input columns and corresponding suggested word
columns have &quot;search engine&quot; and &quot;web search realtime&quot;.</p>
</div>
</div>
<div class="section" id="how-to-use">
<h2>5.5.2. How to use<a class="headerlink" href="#how-to-use" title="Permalink to this headline">¶</a></h2>
<p>Groonga provides <a class="reference internal" href="../commands/suggest.html"><em>suggest</em></a> command to use
suggestion. <cite>--type suggest</cite> option requests suggestion</p>
<p>For example, here is an command to get suggestion results by
&quot;search&quot;:</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>&gt; suggest --table item_query --column kana --types suggest --frequency_threshold 1 --query search
[[0,1317212711.42188,0.000553344],{&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>
</div>
<div class="section" id="how-it-learns">
<h2>5.5.3. How it learns<a class="headerlink" href="#how-it-learns" title="Permalink to this headline">¶</a></h2>
<p>Cooccurrence search uses learned data. They are based on
query logs, access logs and so on. To create learned data,
groonga needs user input sequence with time stamp and user
submit input with time stamp.</p>
<p>For example, an user wants to search by &quot;engine&quot;. The user
inputs the query with the following sequence:</p>
<blockquote>
<div><ol class="arabic simple">
<li>2011-08-10T13:33:23+09:00: search engine (submit)</li>
<li>2011-08-10T13:33:28+09:00: web search realtime (submit)</li>
</ol>
</div></blockquote>
<p>Groonga can be learned from the submissions by the
following command:</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;search engine&quot;, &quot;type&quot;: &quot;submit&quot;},
{&quot;sequence&quot;: &quot;1&quot;, &quot;time&quot;: 1312950808.86057, &quot;item&quot;: &quot;web search realtime&quot;, &quot;type&quot;: &quot;submit&quot;}
]
</pre></div>
</div>
</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="#">5.5. Suggestion</a><ul>
<li><a class="reference internal" href="#how-it-works">5.5.1. How it works</a><ul>
<li><a class="reference internal" href="#cooccurrence-search">5.5.1.1. Cooccurrence search</a></li>
</ul>
</li>
<li><a class="reference internal" href="#how-to-use">5.5.2. How to use</a></li>
<li><a class="reference internal" href="#how-it-learns">5.5.3. How it learns</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="correction.html"
                        title="previous chapter">5.4. Correction</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="../geolocation_search.html"
                        title="next chapter">6. Geolocation Search</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/suggest/suggestion.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" size="18" />
      <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="../geolocation_search.html" title="6. Geolocation Search"
             >next</a> |</li>
        <li class="right" >
          <a href="correction.html" title="5.4. Correction"
             >previous</a> |</li>
        <li><a href="../index.html">groonga v1.2.6 documentation</a> &raquo;</li>
          <li><a href="../suggest.html" >5. Suggest</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2009-2011, Brazil, Inc.
    </div>
  </body>
</html>