HAYASHI Kentaro
null+****@clear*****
Mon Oct 29 12:47:49 JST 2012
HAYASHI Kentaro 2012-10-29 12:47:49 +0900 (Mon, 29 Oct 2012) New Revision: fd549588dd9d6e5f2f0bafb592d021e65c3c07ba https://github.com/groonga/groonga.github.com/commit/fd549588dd9d6e5f2f0bafb592d021e65c3c07ba Log: doc: add missing documentation Added files: docs/reference/query_expanders.html docs/reference/query_expanders/tsv.html docs/sources/reference/query_expanders.txt docs/sources/reference/query_expanders/tsv.txt ja/docs/reference/query_expanders.html ja/docs/reference/query_expanders/tsv.html ja/docs/sources/reference/query_expanders.txt ja/docs/sources/reference/query_expanders/tsv.txt Added: docs/reference/query_expanders.html (+162 -0) 100644 =================================================================== --- /dev/null +++ docs/reference/query_expanders.html 2012-10-29 12:47:49 +0900 (6ad62e0) @@ -0,0 +1,162 @@ +<!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.7. Query expanders — groonga v2.0.8 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: '2.0.8', + 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 v2.0.8 documentation" href="../index.html" /> + <link rel="up" title="8. リファレンスマニュアル" href="../reference.html" /> + <link rel="next" title="8.7.1. QueryExpanderTSV" href="query_expanders/tsv.html" /> + <link rel="prev" title="8.6. Tokenizers" href="tokenizers.html" /> + <meta property="fb:page_id" content="201193596592346" /><!-- groonga --> + <meta property="fb:admins" content="664204556" /><!-- kouhei.sutou --> + <meta property="og:type" content="product" /> + <meta property="og:image" content="http://groonga.org/images/logos/groonga-icon-full-size.png" /> + <meta property="og:site_name" content="groonga" /> + + <link rel="stylesheet" href="/css/sphinx.css" type="text/css" /> + </head> + + <body> + <div id="fb-root"></div> + +<div class="header"> + <h1 class="title"> + <a id="top-link" href="../../"> + <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="facebook-buttons"> + <fb:like href="http://www.facebook.com/pages/groonga/201193596592346" + layout="standard" + width="290"></fb:like> + </div> + <div class="other-language-links"> + + <ul> + <li><a href="../../ja/docs/reference/query_expanders.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="query_expanders/tsv.html" title="8.7.1. QueryExpanderTSV" + accesskey="N">next</a> |</li> + <li class="right" > + <a href="tokenizers.html" title="8.6. Tokenizers" + accesskey="P">previous</a> |</li> + <li><a href="../index.html">groonga v2.0.8 documentation</a> »</li> + <li><a href="../reference.html" accesskey="U">8. リファレンスマニュアル</a> »</li> + </ul> + </div> + + <div class="document"> + <div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body"> + + <div class="section" id="query-expanders"> +<h1>8.7. Query expanders<a class="headerlink" href="#query-expanders" title="Permalink to this headline">¶</a></h1> +<div class="toctree-wrapper compound"> +<ul> +<li class="toctree-l1"><a class="reference internal" href="query_expanders/tsv.html">8.7.1. QueryExpanderTSV</a></li> +</ul> +</div> +</div> + + + </div> + </div> + </div> + <div class="sphinxsidebar"> + <div class="sphinxsidebarwrapper"> + <h4>Previous topic</h4> + <p class="topless"><a href="tokenizers.html" + title="previous chapter">8.6. Tokenizers</a></p> + <h4>Next topic</h4> + <p class="topless"><a href="query_expanders/tsv.html" + title="next chapter">8.7.1. QueryExpanderTSV</a></p> + <h3>This Page</h3> + <ul class="this-page-menu"> + <li><a href="../sources/reference/query_expanders.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="query_expanders/tsv.html" title="8.7.1. QueryExpanderTSV" + >next</a> |</li> + <li class="right" > + <a href="tokenizers.html" title="8.6. Tokenizers" + >previous</a> |</li> + <li><a href="../index.html">groonga v2.0.8 documentation</a> »</li> + <li><a href="../reference.html" >8. リファレンスマニュアル</a> »</li> + </ul> + </div> + <div class="footer"> + © Copyright 2009-2012, Brazil, Inc. + </div> + <script src="http://connect.facebook.net/en_US/all.js"></script> + + <script> + FB.init({ + appId : null, + status : true, // check login status + cookie : true, // enable cookies to allow the server to access the session + xfbml : true // parse XFBML + }); + </script> + </body> + +</html> \ No newline at end of file Added: docs/reference/query_expanders/tsv.html (+339 -0) 100644 =================================================================== --- /dev/null +++ docs/reference/query_expanders/tsv.html 2012-10-29 12:47:49 +0900 (a5df28f) @@ -0,0 +1,339 @@ +<!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.7.1. QueryExpanderTSV — groonga v2.0.8 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: '2.0.8', + 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 v2.0.8 documentation" href="../../index.html" /> + <link rel="up" title="8.7. Query expanders" href="../query_expanders.html" /> + <link rel="next" title="8.8. 疑似カラム (pseudo_column)" href="../pseudo_column.html" /> + <link rel="prev" title="8.7. Query expanders" href="../query_expanders.html" /> + <meta property="fb:page_id" content="201193596592346" /><!-- groonga --> + <meta property="fb:admins" content="664204556" /><!-- kouhei.sutou --> + <meta property="og:type" content="product" /> + <meta property="og:image" content="http://groonga.org/images/logos/groonga-icon-full-size.png" /> + <meta property="og:site_name" content="groonga" /> + + <link rel="stylesheet" href="/css/sphinx.css" type="text/css" /> + </head> + + <body> + <div id="fb-root"></div> + +<div class="header"> + <h1 class="title"> + <a id="top-link" href="../../../"> + <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="facebook-buttons"> + <fb:like href="http://www.facebook.com/pages/groonga/201193596592346" + layout="standard" + width="290"></fb:like> + </div> + <div class="other-language-links"> + + <ul> + <li><a href="../../../ja/docs/reference/query_expanders/tsv.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="../pseudo_column.html" title="8.8. 疑似カラム (pseudo_column)" + accesskey="N">next</a> |</li> + <li class="right" > + <a href="../query_expanders.html" title="8.7. Query expanders" + accesskey="P">previous</a> |</li> + <li><a href="../../index.html">groonga v2.0.8 documentation</a> »</li> + <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> + <li><a href="../query_expanders.html" accesskey="U">8.7. Query expanders</a> »</li> + </ul> + </div> + + <div class="document"> + <div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body"> + + <div class="section" id="queryexpandertsv"> +<h1>8.7.1. QueryExpanderTSV<a class="headerlink" href="#queryexpandertsv" title="Permalink to this headline">¶</a></h1> +<div class="section" id="summary"> +<h2>8.7.1.1. Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">QueryExpanderTSV</span></tt> is a query expander plugin that reads synonyms +from TSV (Tab Separated Values) file. This plugin provides poor +feature than the embedded query expansion feature. For example, it +doesn't support word normalization. But it may be easy to use because +you can manage your synonyms by TSV file. You can edit your synonyms +by spreadsheet application such as Excel. With the embedded query +expansion feature, you manage your synonyms by groonga's table.</p> +</div> +<div class="section" id="install"> +<h2>8.7.1.2. Install<a class="headerlink" href="#install" title="Permalink to this headline">¶</a></h2> +<p>You need to register <tt class="docutils literal"><span class="pre">query_expanders/tsv</span></tt> as a plugin before you +use <tt class="docutils literal"><span class="pre">QueryExpanderTSV</span></tt>:</p> +<div class="highlight-none"><div class="highlight"><pre>register query_expanders/tsv +</pre></div> +</div> +</div> +<div class="section" id="usage"> +<h2>8.7.1.3. Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2> +<p>You just add <tt class="docutils literal"><span class="pre">--query_expansion</span> <span class="pre">QueryExpanderTSV</span></tt> parameter to +<tt class="docutils literal"><span class="pre">select</span></tt> command:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "QUERY" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p>If <tt class="docutils literal"><span class="pre">QUERY</span></tt> has registered synonyms, they are expanded. For example, +there are the following synonyms.</p> +<table border="1" class="docutils"> +<colgroup> +<col width="38%" /> +<col width="32%" /> +<col width="30%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">word</th> +<th class="head">synonym 1</th> +<th class="head">synonym 2</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td>groonga</td> +<td>groonga</td> +<td>Senna</td> +</tr> +<tr class="row-odd"><td>mroonga</td> +<td>mroonga</td> +<td>groonga MySQL</td> +</tr> +</tbody> +</table> +<p>The table means that <tt class="docutils literal"><span class="pre">synonym</span> <span class="pre">1</span></tt> and <tt class="docutils literal"><span class="pre">synonym</span> <span class="pre">2</span></tt> are synonyms of +<tt class="docutils literal"><span class="pre">word</span></tt>. For example, <tt class="docutils literal"><span class="pre">groonga</span></tt> and <tt class="docutils literal"><span class="pre">Senna</span></tt> are synonyms of +<tt class="docutils literal"><span class="pre">groonga</span></tt>. And <tt class="docutils literal"><span class="pre">mroonga</span></tt> and <tt class="docutils literal"><span class="pre">groonga</span> <span class="pre">MySQL</span></tt> are synonyms of +<tt class="docutils literal"><span class="pre">mroonga</span></tt>.</p> +<p>Here is an example of query expnasion that uses <tt class="docutils literal"><span class="pre">groonga</span></tt> as query:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "groonga" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p>The above command equals to the following command:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "groonga OR Senna" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p>Here is another example of query expnasion that uses <tt class="docutils literal"><span class="pre">mroonga</span> +<span class="pre">search</span></tt> as query:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "mroonga search" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p>The above command equals to the following command:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "(mroonga OR (groonga MySQL)) search" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p>It is important that registered words (<tt class="docutils literal"><span class="pre">groonga</span></tt> and <tt class="docutils literal"><span class="pre">mroonga</span></tt>) +are only expanded to synonyms and not registered words (<tt class="docutils literal"><span class="pre">search</span></tt>) +are not expanded. Query expansion isn't occurred +recursively. <tt class="docutils literal"><span class="pre">groonga</span></tt> is appeared in <tt class="docutils literal"><span class="pre">(mroonga</span> <span class="pre">OR</span> <span class="pre">(groonga</span> +<span class="pre">MySQL))</span></tt> as query expansion result but it isn't expanded.</p> +<p>Normally, you need to include <tt class="docutils literal"><span class="pre">word</span></tt> itself into synonyms. For +example, <tt class="docutils literal"><span class="pre">groonga</span></tt> and <tt class="docutils literal"><span class="pre">mroonga</span></tt> are included in synonyms of +themselves. If you want to ignore <tt class="docutils literal"><span class="pre">word</span></tt> itself, you don't include +<tt class="docutils literal"><span class="pre">word</span></tt> itself into synonyms. For example, if you want to use query +expansion as spelling correction, you should use the following +synonyms.</p> +<table border="1" class="docutils"> +<colgroup> +<col width="54%" /> +<col width="46%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">word</th> +<th class="head">synonym</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td>gronga</td> +<td>groonga</td> +</tr> +</tbody> +</table> +<p><tt class="docutils literal"><span class="pre">gronga</span></tt> in <tt class="docutils literal"><span class="pre">word</span></tt> has a typo. A <tt class="docutils literal"><span class="pre">o</span></tt> is missing. <tt class="docutils literal"><span class="pre">groonga</span></tt> in +<tt class="docutils literal"><span class="pre">synonym</span></tt> is the correct word.</p> +<p>Here is an example of using query expnasion as spelling correction:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "gronga" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p>The above command equals to the following command:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "groonga" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p>The former command has a typo in <tt class="docutils literal"><span class="pre">--query</span></tt> value but the latter +command doesn't have any typos.</p> +</div> +<div class="section" id="tsv-file"> +<h2>8.7.1.4. TSV File<a class="headerlink" href="#tsv-file" title="Permalink to this headline">¶</a></h2> +<p>Synonyms are defined in TSV format file. This section describes about +it.</p> +<div class="section" id="location"> +<h3>8.7.1.4.1. Location<a class="headerlink" href="#location" title="Permalink to this headline">¶</a></h3> +<p>The file name should be <tt class="docutils literal"><span class="pre">synonyms.tsv</span></tt> and it is located at +configuration directory. For example, <tt class="docutils literal"><span class="pre">/etc/groonga/synonyms.tsv</span></tt> is +a TSV file location. The location is decided at build time.</p> +<p>You can change the location by environment variable +<tt class="docutils literal"><span class="pre">GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE</span></tt> at run time:</p> +<div class="highlight-none"><div class="highlight"><pre>% env GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE=/tmp/synonyms.tsv groonga +</pre></div> +</div> +<p>With the above command, <tt class="docutils literal"><span class="pre">/tmp/synonyms.tsv</span></tt> file is used.</p> +</div> +<div class="section" id="format"> +<h3>8.7.1.4.2. Format<a class="headerlink" href="#format" title="Permalink to this headline">¶</a></h3> +<p>You can define zero or more synonyms in a TSV file. You define a +<tt class="docutils literal"><span class="pre">word</span></tt> and <tt class="docutils literal"><span class="pre">synonyms</span></tt> pair by a line. <tt class="docutils literal"><span class="pre">word</span></tt> is expanded to +<tt class="docutils literal"><span class="pre">synonyms</span></tt> in <tt class="docutils literal"><span class="pre">--query</span></tt> value. <tt class="docutils literal"><span class="pre">Synonyms</span></tt> are combined by +<tt class="docutils literal"><span class="pre">OR</span></tt>. For example, <tt class="docutils literal"><span class="pre">groonga</span></tt> and <tt class="docutils literal"><span class="pre">Senna</span></tt> synonyms are expanded +as <tt class="docutils literal"><span class="pre">groonga</span> <span class="pre">OR</span> <span class="pre">Senna</span></tt>.</p> +<p>The first column is <tt class="docutils literal"><span class="pre">word</span></tt> and the rest columns are <tt class="docutils literal"><span class="pre">synonyms</span></tt> of +the <tt class="docutils literal"><span class="pre">word</span></tt>. Here is a sample line for <tt class="docutils literal"><span class="pre">word</span></tt> is <tt class="docutils literal"><span class="pre">groonga</span></tt> and +<tt class="docutils literal"><span class="pre">synonyms</span></tt> are <tt class="docutils literal"><span class="pre">groonga</span></tt> and <tt class="docutils literal"><span class="pre">Senna</span></tt>. <tt class="docutils literal"><span class="pre">(TAB)</span></tt> means a tab +character (<tt class="docutils literal"><span class="pre">U+0009</span></tt>):</p> +<div class="highlight-none"><div class="highlight"><pre>groonga(TAB)groonga(TAB)Senna +</pre></div> +</div> +<p>Comment line is supported. Lines that start with <tt class="docutils literal"><span class="pre">#</span></tt> are ignored. +Here is an example for comment line. <tt class="docutils literal"><span class="pre">groonga</span></tt> line is ignored as +comment line:</p> +<div class="highlight-none"><div class="highlight"><pre>#groonga(TAB)groonga(TAB)Senna +mroonga(TAB)mroonga(TAB)groonga MySQL +</pre></div> +</div> +</div> +</div> +<div class="section" id="limitation"> +<h2>8.7.1.5. Limitation<a class="headerlink" href="#limitation" title="Permalink to this headline">¶</a></h2> +<p>You need to restart groonga to reload your synonyms. TSV file is +loaded only at the plugin load time.</p> +</div> +<div class="section" id="see-also"> +<h2>8.7.1.6. See also<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h2> +<blockquote> +<div><ul class="simple"> +<li><a class="reference internal" href="../commands/select.html#query-expansion"><em>query_expansion</em></a></li> +</ul> +</div></blockquote> +</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.7.1. QueryExpanderTSV</a><ul> +<li><a class="reference internal" href="#summary">8.7.1.1. Summary</a></li> +<li><a class="reference internal" href="#install">8.7.1.2. Install</a></li> +<li><a class="reference internal" href="#usage">8.7.1.3. Usage</a></li> +<li><a class="reference internal" href="#tsv-file">8.7.1.4. TSV File</a><ul> +<li><a class="reference internal" href="#location">8.7.1.4.1. Location</a></li> +<li><a class="reference internal" href="#format">8.7.1.4.2. Format</a></li> +</ul> +</li> +<li><a class="reference internal" href="#limitation">8.7.1.5. Limitation</a></li> +<li><a class="reference internal" href="#see-also">8.7.1.6. See also</a></li> +</ul> +</li> +</ul> + + <h4>Previous topic</h4> + <p class="topless"><a href="../query_expanders.html" + title="previous chapter">8.7. Query expanders</a></p> + <h4>Next topic</h4> + <p class="topless"><a href="../pseudo_column.html" + title="next chapter">8.8. 疑似カラム (pseudo_column)</a></p> + <h3>This Page</h3> + <ul class="this-page-menu"> + <li><a href="../../sources/reference/query_expanders/tsv.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="../pseudo_column.html" title="8.8. 疑似カラム (pseudo_column)" + >next</a> |</li> + <li class="right" > + <a href="../query_expanders.html" title="8.7. Query expanders" + >previous</a> |</li> + <li><a href="../../index.html">groonga v2.0.8 documentation</a> »</li> + <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> + <li><a href="../query_expanders.html" >8.7. Query expanders</a> »</li> + </ul> + </div> + <div class="footer"> + © Copyright 2009-2012, Brazil, Inc. + </div> + <script src="http://connect.facebook.net/en_US/all.js"></script> + + <script> + FB.init({ + appId : null, + status : true, // check login status + cookie : true, // enable cookies to allow the server to access the session + xfbml : true // parse XFBML + }); + </script> + </body> + +</html> \ No newline at end of file Added: docs/sources/reference/query_expanders.txt (+12 -0) 100644 =================================================================== --- /dev/null +++ docs/sources/reference/query_expanders.txt 2012-10-29 12:47:49 +0900 (94d92bc) @@ -0,0 +1,12 @@ +.. -*- rst -*- + +.. highlightlang:: none + +Query expanders +=============== + +.. toctree:: + :maxdepth: 1 + :glob: + + query_expanders/* Added: docs/sources/reference/query_expanders/tsv.txt (+153 -0) 100644 =================================================================== --- /dev/null +++ docs/sources/reference/query_expanders/tsv.txt 2012-10-29 12:47:49 +0900 (515a7ad) @@ -0,0 +1,153 @@ +.. -*- rst -*- + +.. highlightlang:: none + +QueryExpanderTSV +================ + +Summary +------- + +``QueryExpanderTSV`` is a query expander plugin that reads synonyms +from TSV (Tab Separated Values) file. This plugin provides poor +feature than the embedded query expansion feature. For example, it +doesn't support word normalization. But it may be easy to use because +you can manage your synonyms by TSV file. You can edit your synonyms +by spreadsheet application such as Excel. With the embedded query +expansion feature, you manage your synonyms by groonga's table. + +Install +------- + +You need to register ``query_expanders/tsv`` as a plugin before you +use ``QueryExpanderTSV``:: + + register query_expanders/tsv + +Usage +----- + +You just add ``--query_expansion QueryExpanderTSV`` parameter to +``select`` command:: + + select --query "QUERY" --query_expansion QueryExpanderTSV + +If ``QUERY`` has registered synonyms, they are expanded. For example, +there are the following synonyms. + ++----------------------------+------------------------+----------------------+ +| word | synonym 1 | synonym 2 | ++============================+========================+======================+ +| groonga | groonga | Senna | ++----------------------------+------------------------+----------------------+ +| mroonga | mroonga | groonga MySQL | ++----------------------------+------------------------+----------------------+ + +The table means that ``synonym 1`` and ``synonym 2`` are synonyms of +``word``. For example, ``groonga`` and ``Senna`` are synonyms of +``groonga``. And ``mroonga`` and ``groonga MySQL`` are synonyms of +``mroonga``. + +Here is an example of query expnasion that uses ``groonga`` as query:: + + select --query "groonga" --query_expansion QueryExpanderTSV + +The above command equals to the following command:: + + select --query "groonga OR Senna" --query_expansion QueryExpanderTSV + +Here is another example of query expnasion that uses ``mroonga +search`` as query:: + + select --query "mroonga search" --query_expansion QueryExpanderTSV + +The above command equals to the following command:: + + select --query "(mroonga OR (groonga MySQL)) search" --query_expansion QueryExpanderTSV + +It is important that registered words (``groonga`` and ``mroonga``) +are only expanded to synonyms and not registered words (``search``) +are not expanded. Query expansion isn't occurred +recursively. ``groonga`` is appeared in ``(mroonga OR (groonga +MySQL))`` as query expansion result but it isn't expanded. + +Normally, you need to include ``word`` itself into synonyms. For +example, ``groonga`` and ``mroonga`` are included in synonyms of +themselves. If you want to ignore ``word`` itself, you don't include +``word`` itself into synonyms. For example, if you want to use query +expansion as spelling correction, you should use the following +synonyms. + ++----------------------------+------------------------+ +| word | synonym | ++============================+========================+ +| gronga | groonga | ++----------------------------+------------------------+ + +``gronga`` in ``word`` has a typo. A ``o`` is missing. ``groonga`` in +``synonym`` is the correct word. + +Here is an example of using query expnasion as spelling correction:: + + select --query "gronga" --query_expansion QueryExpanderTSV + +The above command equals to the following command:: + + select --query "groonga" --query_expansion QueryExpanderTSV + +The former command has a typo in ``--query`` value but the latter +command doesn't have any typos. + +TSV File +-------- + +Synonyms are defined in TSV format file. This section describes about +it. + +Location +^^^^^^^^ + +The file name should be ``synonyms.tsv`` and it is located at +configuration directory. For example, ``/etc/groonga/synonyms.tsv`` is +a TSV file location. The location is decided at build time. + +You can change the location by environment variable +``GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE`` at run time:: + + % env GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE=/tmp/synonyms.tsv groonga + +With the above command, ``/tmp/synonyms.tsv`` file is used. + +Format +^^^^^^ + +You can define zero or more synonyms in a TSV file. You define a +``word`` and ``synonyms`` pair by a line. ``word`` is expanded to +``synonyms`` in ``--query`` value. ``Synonyms`` are combined by +``OR``. For example, ``groonga`` and ``Senna`` synonyms are expanded +as ``groonga OR Senna``. + +The first column is ``word`` and the rest columns are ``synonyms`` of +the ``word``. Here is a sample line for ``word`` is ``groonga`` and +``synonyms`` are ``groonga`` and ``Senna``. ``(TAB)`` means a tab +character (``U+0009``):: + + groonga(TAB)groonga(TAB)Senna + +Comment line is supported. Lines that start with ``#`` are ignored. +Here is an example for comment line. ``groonga`` line is ignored as +comment line:: + + #groonga(TAB)groonga(TAB)Senna + mroonga(TAB)mroonga(TAB)groonga MySQL + +Limitation +---------- + +You need to restart groonga to reload your synonyms. TSV file is +loaded only at the plugin load time. + +See also +-------- + + * :ref:`query-expansion` Added: ja/docs/reference/query_expanders.html (+163 -0) 100644 =================================================================== --- /dev/null +++ ja/docs/reference/query_expanders.html 2012-10-29 12:47:49 +0900 (657df86) @@ -0,0 +1,163 @@ +<!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.7. クエリー展開オブジェクト一覧 — groonga v2.0.8ドキュメント</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: '2.0.8', + 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> + <script type="text/javascript" src="../static/translations.js"></script> + <link rel="shortcut icon" href="../static/favicon.ico"/> + <link rel="top" title="groonga v2.0.8ドキュメント" href="../index.html" /> + <link rel="up" title="8. リファレンスマニュアル" href="../reference.html" /> + <link rel="next" title="8.7.1. QueryExpanderTSV" href="query_expanders/tsv.html" /> + <link rel="prev" title="8.6. Tokenizers" href="tokenizers.html" /> + <meta property="fb:page_id" content="201193596592346" /><!-- groonga --> + <meta property="fb:admins" content="664204556" /><!-- kouhei.sutou --> + <meta property="og:type" content="product" /> + <meta property="og:image" content="http://groonga.org/images/logos/groonga-icon-full-size.png" /> + <meta property="og:site_name" content="groonga" /> + + <link rel="stylesheet" href="/css/sphinx.css" type="text/css" /> + </head> + + <body> + <div id="fb-root"></div> + +<div class="header"> + <h1 class="title"> + <a id="top-link" href="../../"> + <span class="project">groonga</span> + <span class="separator">-</span> + <span class="description">オープンソースのカラムストア機能付き全文検索エンジン</span> + </a> + </h1> + + <div class="facebook-buttons"> + <fb:like href="http://www.facebook.com/pages/groonga/201193596592346" + layout="standard" + width="290"></fb:like> + </div> + <div class="other-language-links"> + + <ul> + <li><a href="../../../docs/reference/query_expanders.html"><img src="../static/us.png" alt="English">English page</a></li> + </ul> + </div> +</div> + + + <div class="related"> + <h3>ナビゲーション</h3> + <ul> + <li class="right" style="margin-right: 10px"> + <a href="../genindex.html" title="総合索引" + accesskey="I">索引</a></li> + <li class="right" > + <a href="query_expanders/tsv.html" title="8.7.1. QueryExpanderTSV" + accesskey="N">次へ</a> |</li> + <li class="right" > + <a href="tokenizers.html" title="8.6. Tokenizers" + accesskey="P">前へ</a> |</li> + <li><a href="../index.html">groonga v2.0.8ドキュメント</a> »</li> + <li><a href="../reference.html" accesskey="U">8. リファレンスマニュアル</a> »</li> + </ul> + </div> + + <div class="document"> + <div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body"> + + <div class="section" id="query-expanders"> +<h1>8.7. クエリー展開オブジェクト一覧<a class="headerlink" href="#query-expanders" title="このヘッドラインへのパーマリンク">¶</a></h1> +<div class="toctree-wrapper compound"> +<ul> +<li class="toctree-l1"><a class="reference internal" href="query_expanders/tsv.html">8.7.1. QueryExpanderTSV</a></li> +</ul> +</div> +</div> + + + </div> + </div> + </div> + <div class="sphinxsidebar"> + <div class="sphinxsidebarwrapper"> + <h4>前のトピックへ</h4> + <p class="topless"><a href="tokenizers.html" + title="前の章へ">8.6. Tokenizers</a></p> + <h4>次のトピックへ</h4> + <p class="topless"><a href="query_expanders/tsv.html" + title="次の章へ">8.7.1. QueryExpanderTSV</a></p> + <h3>このページ</h3> + <ul class="this-page-menu"> + <li><a href="../sources/reference/query_expanders.txt" + rel="nofollow">ソースコードを表示</a></li> + </ul> +<div id="searchbox" style="display: none"> + <h3>クイック検索</h3> + <form class="search" action="../search.html" method="get"> + <input type="text" name="q" /> + <input type="submit" value="検索" /> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> + </form> + <p class="searchtip" style="font-size: 90%"> + モジュール、クラス、または関数名を入力してください + </p> +</div> +<script type="text/javascript">$('#searchbox').show(0);</script> + </div> + </div> + <div class="clearer"></div> + </div> + <div class="related"> + <h3>ナビゲーション</h3> + <ul> + <li class="right" style="margin-right: 10px"> + <a href="../genindex.html" title="総合索引" + >索引</a></li> + <li class="right" > + <a href="query_expanders/tsv.html" title="8.7.1. QueryExpanderTSV" + >次へ</a> |</li> + <li class="right" > + <a href="tokenizers.html" title="8.6. Tokenizers" + >前へ</a> |</li> + <li><a href="../index.html">groonga v2.0.8ドキュメント</a> »</li> + <li><a href="../reference.html" >8. リファレンスマニュアル</a> »</li> + </ul> + </div> + <div class="footer"> + © Copyright 2009-2012, Brazil, Inc. + </div> + <script src="http://connect.facebook.net/ja_JP/all.js"></script> + + <script> + FB.init({ + appId : null, + status : true, // check login status + cookie : true, // enable cookies to allow the server to access the session + xfbml : true // parse XFBML + }); + </script> + </body> + +</html> \ No newline at end of file Added: ja/docs/reference/query_expanders/tsv.html (+302 -0) 100644 =================================================================== --- /dev/null +++ ja/docs/reference/query_expanders/tsv.html 2012-10-29 12:47:49 +0900 (80905f6) @@ -0,0 +1,302 @@ +<!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.7.1. QueryExpanderTSV — groonga v2.0.8ドキュメント</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: '2.0.8', + 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> + <script type="text/javascript" src="../../static/translations.js"></script> + <link rel="shortcut icon" href="../../static/favicon.ico"/> + <link rel="top" title="groonga v2.0.8ドキュメント" href="../../index.html" /> + <link rel="up" title="8.7. クエリー展開オブジェクト一覧" href="../query_expanders.html" /> + <link rel="next" title="8.8. 疑似カラム (pseudo_column)" href="../pseudo_column.html" /> + <link rel="prev" title="8.7. クエリー展開オブジェクト一覧" href="../query_expanders.html" /> + <meta property="fb:page_id" content="201193596592346" /><!-- groonga --> + <meta property="fb:admins" content="664204556" /><!-- kouhei.sutou --> + <meta property="og:type" content="product" /> + <meta property="og:image" content="http://groonga.org/images/logos/groonga-icon-full-size.png" /> + <meta property="og:site_name" content="groonga" /> + + <link rel="stylesheet" href="/css/sphinx.css" type="text/css" /> + </head> + + <body> + <div id="fb-root"></div> + +<div class="header"> + <h1 class="title"> + <a id="top-link" href="../../../"> + <span class="project">groonga</span> + <span class="separator">-</span> + <span class="description">オープンソースのカラムストア機能付き全文検索エンジン</span> + </a> + </h1> + + <div class="facebook-buttons"> + <fb:like href="http://www.facebook.com/pages/groonga/201193596592346" + layout="standard" + width="290"></fb:like> + </div> + <div class="other-language-links"> + + <ul> + <li><a href="../../../../docs/reference/query_expanders/tsv.html"><img src="../../static/us.png" alt="English">English page</a></li> + </ul> + </div> +</div> + + + <div class="related"> + <h3>ナビゲーション</h3> + <ul> + <li class="right" style="margin-right: 10px"> + <a href="../../genindex.html" title="総合索引" + accesskey="I">索引</a></li> + <li class="right" > + <a href="../pseudo_column.html" title="8.8. 疑似カラム (pseudo_column)" + accesskey="N">次へ</a> |</li> + <li class="right" > + <a href="../query_expanders.html" title="8.7. クエリー展開オブジェクト一覧" + accesskey="P">前へ</a> |</li> + <li><a href="../../index.html">groonga v2.0.8ドキュメント</a> »</li> + <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> + <li><a href="../query_expanders.html" accesskey="U">8.7. クエリー展開オブジェクト一覧</a> »</li> + </ul> + </div> + + <div class="document"> + <div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body"> + + <div class="section" id="queryexpandertsv"> +<h1>8.7.1. QueryExpanderTSV<a class="headerlink" href="#queryexpandertsv" title="このヘッドラインへのパーマリンク">¶</a></h1> +<div class="section" id="summary"> +<h2>8.7.1.1. 概要<a class="headerlink" href="#summary" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">QueryExpanderTSV</span></tt> はクエリー展開プラグインです。同義語はTSV(データをタブで区切るファイルフォーマット)ファイルから読み込みます。このプラグインは組み込みのクエリー展開機能よりも機能が少ないです。例えば、単語の正規化をサポートしていません。しかし、TSVファイルで同義語を管理できるためこちらの方が使いやすいかもしれません。TSVファイルなのでExcelなどの表計算ソフトで同義語を編集できます。組み込みのクエリー展開機能では、groongaのテーブルとして同義語を管理します。</p> +</div> +<div class="section" id="install"> +<h2>8.7.1.2. インストール<a class="headerlink" href="#install" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">QueryExpanderTSV</span></tt> を使う前に <tt class="docutils literal"><span class="pre">query_expanders/tsv</span></tt> をプラグインとして登録します:</p> +<div class="highlight-none"><div class="highlight"><pre>register query_expanders/tsv +</pre></div> +</div> +</div> +<div class="section" id="usage"> +<h2>8.7.1.3. 使い方<a class="headerlink" href="#usage" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">select</span></tt> コマンドに <tt class="docutils literal"><span class="pre">--query_expansion</span> <span class="pre">QueryExpanderTSV</span></tt> パラメーターを追加します:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "QUERY" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p><tt class="docutils literal"><span class="pre">QUERY</span></tt> 内に登録済みの同義語がある場合はそれらが展開されます。例えば、以下の同義語があるとします。</p> +<table border="1" class="docutils"> +<colgroup> +<col width="38%" /> +<col width="32%" /> +<col width="30%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">単語</th> +<th class="head">同義語1</th> +<th class="head">同義語2</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td>groonga</td> +<td>groonga</td> +<td>Senna</td> +</tr> +<tr class="row-odd"><td>mroonga</td> +<td>mroonga</td> +<td>groonga MySQL</td> +</tr> +</tbody> +</table> +<p>この表は、 <tt class="docutils literal"><span class="pre">単語</span></tt> の同義語は <tt class="docutils literal"><span class="pre">同義語1</span></tt> と <tt class="docutils literal"><span class="pre">同義語2</span></tt> という意味です。例えば、 <tt class="docutils literal"><span class="pre">groonga</span></tt> の同義語は <tt class="docutils literal"><span class="pre">groonga</span></tt> と <tt class="docutils literal"><span class="pre">Senna</span></tt> です。また、 <tt class="docutils literal"><span class="pre">mroonga</span></tt> の同義語は <tt class="docutils literal"><span class="pre">mroonga</span></tt> と <tt class="docutils literal"><span class="pre">groonga</span> <span class="pre">MySQL</span></tt> です。</p> +<p>クエリーが <tt class="docutils literal"><span class="pre">groonga</span></tt> のときのクエリー展開の例です:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "groonga" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p>上記のコマンドは以下のコマンドと同じ意味です:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "groonga OR Senna" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p>クエリーが <tt class="docutils literal"><span class="pre">mroonga</span> <span class="pre">search</span></tt> のときのクエリー展開の例です:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "mroonga search" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p>上記のコマンドは以下のコマンドと同じ意味です:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "(mroonga OR (groonga MySQL)) search" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p>登録されている単語だけ(ここでは <tt class="docutils literal"><span class="pre">groonga</span></tt> と <tt class="docutils literal"><span class="pre">mroonga</span></tt> )クエリー展開されて、登録されていない単語(ここでは <tt class="docutils literal"><span class="pre">search</span></tt> )はクエリー展開されていないことが大事なポイントです。また、再帰的にクエリー展開しません。クエリー展開した結果の <tt class="docutils literal"><span class="pre">(mroonga</span> <span class="pre">OR</span> <span class="pre">(groonga</span> <span class="pre">MySQL))</span></tt> の中に <tt class="docutils literal"><span class="pre">groonga</span></tt> がありますが、これは展開されません。</p> +<p>通常、同義語の中に <tt class="docutils literal"><span class="pre">単語</span></tt> 自身も含める必要があります。例えば、 <tt class="docutils literal"><span class="pre">groonga</span></tt> と <tt class="docutils literal"><span class="pre">mroonga</span></tt> が同義語の中に含まれています。もし、 <tt class="docutils literal"><span class="pre">単語</span></tt> 自身を無視したい場合は同義語の中に <tt class="docutils literal"><span class="pre">単語</span></tt> を含めないでください。例えば、クエリー展開機能をスペル訂正機能として使う場合は、以下のような同義語を使ってください。</p> +<table border="1" class="docutils"> +<colgroup> +<col width="54%" /> +<col width="46%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">単語</th> +<th class="head">同義語</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td>gronga</td> +<td>groonga</td> +</tr> +</tbody> +</table> +<p><tt class="docutils literal"><span class="pre">単語</span></tt> の <tt class="docutils literal"><span class="pre">gronga</span></tt> には誤字があります。 <tt class="docutils literal"><span class="pre">o</span></tt> がひとつ足りません。 <tt class="docutils literal"><span class="pre">同義語</span></tt> の <tt class="docutils literal"><span class="pre">groonga</span></tt> が正しい単語です。</p> +<p>スペル訂正機能としてクエリー展開機能を使う例です:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "gronga" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p>上記のコマンドは以下のコマンドと同じ意味です:</p> +<div class="highlight-none"><div class="highlight"><pre>select --query "groonga" --query_expansion QueryExpanderTSV +</pre></div> +</div> +<p>前者のコマンドは <tt class="docutils literal"><span class="pre">--query</span></tt> の値に誤字がありますが、後者のコマンドは誤字がありません。</p> +</div> +<div class="section" id="tsv-file"> +<h2>8.7.1.4. TSVファイル<a class="headerlink" href="#tsv-file" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p>同義語はTSVフォーマットのファイルで定義します。このセクションでは定義方法について説明します。</p> +<div class="section" id="location"> +<h3>8.7.1.4.1. 場所<a class="headerlink" href="#location" title="このヘッドラインへのパーマリンク">¶</a></h3> +<p>TSVファイルのファイル名は <tt class="docutils literal"><span class="pre">synonyms.tsv</span></tt> で、設定ディレクトリに置かなければいけません。例えば、 <tt class="docutils literal"><span class="pre">/etc/groonga/synonyms.tsv</span></tt> がTSVファイルの場所になります。場所はビルド時に決まります。</p> +<p>環境変数 <tt class="docutils literal"><span class="pre">GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE</span></tt> を指定することで実行時に場所を変更することもできます:</p> +<div class="highlight-none"><div class="highlight"><pre>% env GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE=/tmp/synonyms.tsv groonga +</pre></div> +</div> +<p>上述のコマンドでは <tt class="docutils literal"><span class="pre">/tmp/synonyms.tsv</span></tt> ファイルが使われます。</p> +</div> +<div class="section" id="format"> +<h3>8.7.1.4.2. フォーマット<a class="headerlink" href="#format" title="このヘッドラインへのパーマリンク">¶</a></h3> +<p>TSVファイル内に0個以上の同義語を定義することができます。1行につき <tt class="docutils literal"><span class="pre">単語</span></tt> と <tt class="docutils literal"><span class="pre">同義語リスト</span></tt> のペアを定義します。 <tt class="docutils literal"><span class="pre">--query</span></tt> の値の中にでてきた <tt class="docutils literal"><span class="pre">単語</span></tt> は <tt class="docutils literal"><span class="pre">同義語リスト</span></tt> に展開されます。 <tt class="docutils literal"><span class="pre">同義語リスト</span></tt> は <tt class="docutils literal"><span class="pre">OR</span></tt> でまとめます。例えば、同義語リスト <tt class="docutils literal"><span class="pre">groonga</span></tt> と <tt class="docutils literal"><span class="pre">Senna</span></tt> は <tt class="docutils literal"><span class="pre">groonga</span> <span class="pre">OR</span> <span class="pre" >Senna</span></tt> と展開されます。</p> +<p>最初のカラムが <tt class="docutils literal"><span class="pre">単語</span></tt> で、残りのカラムが <tt class="docutils literal"><span class="pre">単語</span></tt> の <tt class="docutils literal"><span class="pre">同義語リスト</span></tt> になります。以下は、 <tt class="docutils literal"><span class="pre">単語</span></tt> が <tt class="docutils literal"><span class="pre">groonga</span></tt> で、 <tt class="docutils literal"><span class="pre">同義語リスト</span></tt> が <tt class="docutils literal"><span class="pre">groonga</span></tt> と <tt class="docutils literal"><span class="pre">synonyms</span></tt> の例です。 <tt class="docutils literal"><span class="pre">(TAB)</span></tt> はタブ文字( <tt class="docutils literal"><span class="pre">U+0009</span></tt> )という意味です:</p> +<div class="highlight-none"><div class="highlight"><pre>groonga(TAB)groonga(TAB)Senna +</pre></div> +</div> +<p>コメント行をサポートしています。 <tt class="docutils literal"><span class="pre">#</span></tt> から始まる行は無視します。以下はコメント行の例です。 <tt class="docutils literal"><span class="pre">groonga</span></tt> とある行はコメント行として無視されます:</p> +<div class="highlight-none"><div class="highlight"><pre>#groonga(TAB)groonga(TAB)Senna +mroonga(TAB)mroonga(TAB)groonga MySQL +</pre></div> +</div> +</div> +</div> +<div class="section" id="limitation"> +<h2>8.7.1.5. 制限<a class="headerlink" href="#limitation" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p>同義語を再読み込みするにはgroongaを再起動する必要があります。TSVファイルはプラグイン読み込み時に一度だけ読み込みます。</p> +</div> +<div class="section" id="see-also"> +<h2>8.7.1.6. 参考<a class="headerlink" href="#see-also" title="このヘッドラインへのパーマリンク">¶</a></h2> +<blockquote> +<div><ul class="simple"> +<li><a class="reference internal" href="../commands/select.html#query-expansion"><em>query_expansion</em></a></li> +</ul> +</div></blockquote> +</div> +</div> + + + </div> + </div> + </div> + <div class="sphinxsidebar"> + <div class="sphinxsidebarwrapper"> + <h3><a href="../../index.html">目次</a></h3> + <ul> +<li><a class="reference internal" href="#">8.7.1. QueryExpanderTSV</a><ul> +<li><a class="reference internal" href="#summary">8.7.1.1. 概要</a></li> +<li><a class="reference internal" href="#install">8.7.1.2. インストール</a></li> +<li><a class="reference internal" href="#usage">8.7.1.3. 使い方</a></li> +<li><a class="reference internal" href="#tsv-file">8.7.1.4. TSVファイル</a><ul> +<li><a class="reference internal" href="#location">8.7.1.4.1. 場所</a></li> +<li><a class="reference internal" href="#format">8.7.1.4.2. フォーマット</a></li> +</ul> +</li> +<li><a class="reference internal" href="#limitation">8.7.1.5. 制限</a></li> +<li><a class="reference internal" href="#see-also">8.7.1.6. 参考</a></li> +</ul> +</li> +</ul> + + <h4>前のトピックへ</h4> + <p class="topless"><a href="../query_expanders.html" + title="前の章へ">8.7. クエリー展開オブジェクト一覧</a></p> + <h4>次のトピックへ</h4> + <p class="topless"><a href="../pseudo_column.html" + title="次の章へ">8.8. 疑似カラム (pseudo_column)</a></p> + <h3>このページ</h3> + <ul class="this-page-menu"> + <li><a href="../../sources/reference/query_expanders/tsv.txt" + rel="nofollow">ソースコードを表示</a></li> + </ul> +<div id="searchbox" style="display: none"> + <h3>クイック検索</h3> + <form class="search" action="../../search.html" method="get"> + <input type="text" name="q" /> + <input type="submit" value="検索" /> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> + </form> + <p class="searchtip" style="font-size: 90%"> + モジュール、クラス、または関数名を入力してください + </p> +</div> +<script type="text/javascript">$('#searchbox').show(0);</script> + </div> + </div> + <div class="clearer"></div> + </div> + <div class="related"> + <h3>ナビゲーション</h3> + <ul> + <li class="right" style="margin-right: 10px"> + <a href="../../genindex.html" title="総合索引" + >索引</a></li> + <li class="right" > + <a href="../pseudo_column.html" title="8.8. 疑似カラム (pseudo_column)" + >次へ</a> |</li> + <li class="right" > + <a href="../query_expanders.html" title="8.7. クエリー展開オブジェクト一覧" + >前へ</a> |</li> + <li><a href="../../index.html">groonga v2.0.8ドキュメント</a> »</li> + <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> + <li><a href="../query_expanders.html" >8.7. クエリー展開オブジェクト一覧</a> »</li> + </ul> + </div> + <div class="footer"> + © Copyright 2009-2012, Brazil, Inc. + </div> + <script src="http://connect.facebook.net/ja_JP/all.js"></script> + + <script> + FB.init({ + appId : null, + status : true, // check login status + cookie : true, // enable cookies to allow the server to access the session + xfbml : true // parse XFBML + }); + </script> + </body> + +</html> \ No newline at end of file Added: ja/docs/sources/reference/query_expanders.txt (+12 -0) 100644 =================================================================== --- /dev/null +++ ja/docs/sources/reference/query_expanders.txt 2012-10-29 12:47:49 +0900 (94d92bc) @@ -0,0 +1,12 @@ +.. -*- rst -*- + +.. highlightlang:: none + +Query expanders +=============== + +.. toctree:: + :maxdepth: 1 + :glob: + + query_expanders/* Added: ja/docs/sources/reference/query_expanders/tsv.txt (+153 -0) 100644 =================================================================== --- /dev/null +++ ja/docs/sources/reference/query_expanders/tsv.txt 2012-10-29 12:47:49 +0900 (515a7ad) @@ -0,0 +1,153 @@ +.. -*- rst -*- + +.. highlightlang:: none + +QueryExpanderTSV +================ + +Summary +------- + +``QueryExpanderTSV`` is a query expander plugin that reads synonyms +from TSV (Tab Separated Values) file. This plugin provides poor +feature than the embedded query expansion feature. For example, it +doesn't support word normalization. But it may be easy to use because +you can manage your synonyms by TSV file. You can edit your synonyms +by spreadsheet application such as Excel. With the embedded query +expansion feature, you manage your synonyms by groonga's table. + +Install +------- + +You need to register ``query_expanders/tsv`` as a plugin before you +use ``QueryExpanderTSV``:: + + register query_expanders/tsv + +Usage +----- + +You just add ``--query_expansion QueryExpanderTSV`` parameter to +``select`` command:: + + select --query "QUERY" --query_expansion QueryExpanderTSV + +If ``QUERY`` has registered synonyms, they are expanded. For example, +there are the following synonyms. + ++----------------------------+------------------------+----------------------+ +| word | synonym 1 | synonym 2 | ++============================+========================+======================+ +| groonga | groonga | Senna | ++----------------------------+------------------------+----------------------+ +| mroonga | mroonga | groonga MySQL | ++----------------------------+------------------------+----------------------+ + +The table means that ``synonym 1`` and ``synonym 2`` are synonyms of +``word``. For example, ``groonga`` and ``Senna`` are synonyms of +``groonga``. And ``mroonga`` and ``groonga MySQL`` are synonyms of +``mroonga``. + +Here is an example of query expnasion that uses ``groonga`` as query:: + + select --query "groonga" --query_expansion QueryExpanderTSV + +The above command equals to the following command:: + + select --query "groonga OR Senna" --query_expansion QueryExpanderTSV + +Here is another example of query expnasion that uses ``mroonga +search`` as query:: + + select --query "mroonga search" --query_expansion QueryExpanderTSV + +The above command equals to the following command:: + + select --query "(mroonga OR (groonga MySQL)) search" --query_expansion QueryExpanderTSV + +It is important that registered words (``groonga`` and ``mroonga``) +are only expanded to synonyms and not registered words (``search``) +are not expanded. Query expansion isn't occurred +recursively. ``groonga`` is appeared in ``(mroonga OR (groonga +MySQL))`` as query expansion result but it isn't expanded. + +Normally, you need to include ``word`` itself into synonyms. For +example, ``groonga`` and ``mroonga`` are included in synonyms of +themselves. If you want to ignore ``word`` itself, you don't include +``word`` itself into synonyms. For example, if you want to use query +expansion as spelling correction, you should use the following +synonyms. + ++----------------------------+------------------------+ +| word | synonym | ++============================+========================+ +| gronga | groonga | ++----------------------------+------------------------+ + +``gronga`` in ``word`` has a typo. A ``o`` is missing. ``groonga`` in +``synonym`` is the correct word. + +Here is an example of using query expnasion as spelling correction:: + + select --query "gronga" --query_expansion QueryExpanderTSV + +The above command equals to the following command:: + + select --query "groonga" --query_expansion QueryExpanderTSV + +The former command has a typo in ``--query`` value but the latter +command doesn't have any typos. + +TSV File +-------- + +Synonyms are defined in TSV format file. This section describes about +it. + +Location +^^^^^^^^ + +The file name should be ``synonyms.tsv`` and it is located at +configuration directory. For example, ``/etc/groonga/synonyms.tsv`` is +a TSV file location. The location is decided at build time. + +You can change the location by environment variable +``GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE`` at run time:: + + % env GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE=/tmp/synonyms.tsv groonga + +With the above command, ``/tmp/synonyms.tsv`` file is used. + +Format +^^^^^^ + +You can define zero or more synonyms in a TSV file. You define a +``word`` and ``synonyms`` pair by a line. ``word`` is expanded to +``synonyms`` in ``--query`` value. ``Synonyms`` are combined by +``OR``. For example, ``groonga`` and ``Senna`` synonyms are expanded +as ``groonga OR Senna``. + +The first column is ``word`` and the rest columns are ``synonyms`` of +the ``word``. Here is a sample line for ``word`` is ``groonga`` and +``synonyms`` are ``groonga`` and ``Senna``. ``(TAB)`` means a tab +character (``U+0009``):: + + groonga(TAB)groonga(TAB)Senna + +Comment line is supported. Lines that start with ``#`` are ignored. +Here is an example for comment line. ``groonga`` line is ignored as +comment line:: + + #groonga(TAB)groonga(TAB)Senna + mroonga(TAB)mroonga(TAB)groonga MySQL + +Limitation +---------- + +You need to restart groonga to reload your synonyms. TSV file is +loaded only at the plugin load time. + +See also +-------- + + * :ref:`query-expansion` -------------- next part -------------- HTML����������������������������... Download