Kouhei Sutou
null+****@clear*****
Mon Aug 25 12:22:59 JST 2014
Kouhei Sutou 2014-08-25 12:22:59 +0900 (Mon, 25 Aug 2014) New Revision: a20a3d84da4aca47ed8e46f91efc4cc8a8a4e11d https://github.com/groonga/groonga.org/commit/a20a3d84da4aca47ed8e46f91efc4cc8a8a4e11d Message: Add new documents Added files: docs/reference/functions/highlight_full.html docs/reference/functions/highlight_html.html docs/sources/reference/functions/highlight_full.txt docs/sources/reference/functions/highlight_html.txt ja/docs/reference/functions/highlight_full.html ja/docs/reference/functions/highlight_html.html ja/docs/sources/reference/functions/highlight_full.txt ja/docs/sources/reference/functions/highlight_html.txt Added: docs/reference/functions/highlight_full.html (+337 -0) 100644 =================================================================== --- /dev/null +++ docs/reference/functions/highlight_full.html 2014-08-25 12:22:59 +0900 (8121d7e) @@ -0,0 +1,337 @@ +<!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.11.6. highlight_full — Groonga v4.0.4 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: '4.0.4', + 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 v4.0.4 documentation" href="../../index.html" /> + <link rel="up" title="8.11. Function" href="../function.html" /> + <link rel="next" title="8.11.7. highlight_html" href="highlight_html.html" /> + <link rel="prev" title="8.11.5. geo_in_rectangle" href="geo_in_rectangle.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/functions/highlight_full.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="highlight_html.html" title="8.11.7. highlight_html" + accesskey="N">next</a> |</li> + <li class="right" > + <a href="geo_in_rectangle.html" title="8.11.5. geo_in_rectangle" + accesskey="P">previous</a> |</li> + <li><a href="../../index.html">Groonga v4.0.4 documentation</a> »</li> + <li><a href="../../reference.html" >8. Reference manual</a> »</li> + <li><a href="../function.html" accesskey="U">8.11. Function</a> »</li> + </ul> + </div> + + <div class="document"> + <div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body"> + + <div class="section" id="highlight-full"> +<h1>8.11.6. highlight_full<a class="headerlink" href="#highlight-full" title="Permalink to this headline">¶</a></h1> +<div class="admonition caution"> +<p class="first admonition-title">Caution</p> +<p class="last">This feature is experimental. API will be changed.</p> +</div> +<div class="section" id="summary"> +<h2>8.11.6.1. Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">highlight_full</span></tt> tags target text. It can use to highlight the search +keyword. It can specify use/not use HTML escape, the normalizer name and +change the tag for each keyword.</p> +</div> +<div class="section" id="syntax"> +<h2>8.11.6.2. Syntax<a class="headerlink" href="#syntax" title="Permalink to this headline">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">highlight_full</span></tt> has required parameter and optional parameter:</p> +<div class="highlight-none"><div class="highlight"><pre>highlight_full(column, normalizer_name, use_html_escape, + keyword1, open_tag1, close_tag1, + ... + [keywordN, open_tagN, close_tagN]) +</pre></div> +</div> +</div> +<div class="section" id="usage"> +<h2>8.11.6.3. Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2> +<p>Here are a schema definition and sample data to show usage.</p> +<p>Execution example:</p> +<div class="highlight-none"><div class="highlight"><pre>table_create Entries TABLE_NO_KEY +# [[0,1407692435.35498,0.0364797115325928],true] +column_create Entries body COLUMN_SCALAR ShortText +# [[0,1407692435.39156,0.0256640911102295],true] +table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +# [[0,1407692435.423,0.0274741649627686],true] +column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body +# [[0,1407692435.45051,0.0534985065460205],true] +load --table Entries +[ +{"body": "Mroonga is a MySQL storage engine based on Groonga. <b>Rroonga</b> is a Ruby binding of Groonga."} +] +# [[0,1407692435.50406,0.378907442092896],1] +</pre></div> +</div> +<p><tt class="docutils literal"><span class="pre">highlight_full</span></tt> can be used in only <tt class="docutils literal"><span class="pre">--output_columns</span></tt> in +<a class="reference internal" href="../commands/select.html"><em>select</em></a>.</p> +<p><tt class="docutils literal"><span class="pre">highlight_full</span></tt> requires Groonga 4.0.5 or later.</p> +<p><tt class="docutils literal"><span class="pre">highlight_full</span></tt> requires <a class="reference internal" href="../command/command_version.html"><em>コマンドバージョン</em></a> 2 +or later.</p> +<p>The following example uses HTML escape and normalzier is <tt class="docutils literal"><span class="pre">NormalizeAuto</span></tt>. +It specifies the tags <tt class="docutils literal"><span class="pre"><span</span> <span class="pre">class="keyword1"></span></tt> and <tt class="docutils literal"><span class="pre"></span></span></tt> of the +keyword <tt class="docutils literal"><span class="pre">groonga</span></tt>, and the tags <tt class="docutils literal"><span class="pre"><span</span> <span class="pre">class="keyword2"></span></tt> and <tt class="docutils literal"><span class="pre"></span></span></tt> +of the keyword <tt class="docutils literal"><span class="pre">mysql</span></tt>.</p> +<p>Execution example:</p> +<div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns 'highlight_full(body, "NormalizerAuto", true, "Groonga", "<span class=\\"keyword1\\">", "</span>", "mysql", "<span class=\\"keyword2\\">", "</span>")' --command_version 2 +# [ +# [ +# 0, +# 1407695996.52987, +# 0.00151872634887695 +# ], +# [ +# [ +# [ +# 1 +# ], +# [ +# [ +# "highlight_full", +# "null" +# ] +# ], +# [ +# "Mroonga is a <span class=\"keyword2\">MySQL</span> storage engine based on <span class=\"keyword1\">Groonga</span>. &lt;b&gt;Rroonga&lt;/b&gt; is a Ruby binding of <span class=\"keyword1\">Groonga</span>." +# ] +# ] +# ] +# ] +</pre></div> +</div> +<p>The text are scanned by the keywords for tagging after they are normalized +by <tt class="docutils literal"><span class="pre">NormalizerAuto</span></tt> normalizer.</p> +<p><tt class="docutils literal"><span class="pre">--query</span> <span class="pre">"groonga</span> <span class="pre">mysql"</span></tt> matches to the first record's body. +<tt class="docutils literal"><span class="pre">highight_full</span></tt> surrounds the keywords <tt class="docutils literal"><span class="pre">groonga</span></tt> contained in the text +with <tt class="docutils literal"><span class="pre"><span</span> <span class="pre">class="keyword1"></span></tt> and <tt class="docutils literal"><span class="pre"></span></span></tt>, and the keywords <tt class="docutils literal"><span class="pre">mysql</span></tt> +contained in the text with with <tt class="docutils literal"><span class="pre"><span</span> <span class="pre">class="keyword2"></span></tt> and <tt class="docutils literal"><span class="pre"></span></span></tt>.</p> +<p>Special characters such as <tt class="docutils literal"><span class="pre"><</span></tt> and <tt class="docutils literal"><span class="pre">></span></tt> are escapsed as <tt class="docutils literal"><span class="pre">&lt;</span></tt> and +<tt class="docutils literal"><span class="pre">&gt;</span></tt>.</p> +<p>You can specify string literal instead of column.</p> +<p>Execution example:</p> +<div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns 'highlight_full("Groonga is very fast fulltext search engine.", "NormalizerAuto", true, "Groonga", "<span class=\\"keyword1\\">", "</span>", "mysql", "<span class=\\"keyword2\\">", "</span>")' --command_version 2 --match_columns body --query "groonga" +# [ +# [ +# 0, +# 1407696157.1849, +# 0.00164437294006348 +# ], +# [ +# [ +# [ +# 1 +# ], +# [ +# [ +# "highlight_full", +# "null" +# ] +# ], +# [ +# "<span class=\"keyword1\">Groonga</span> is very fast fulltext search engine." +# ] +# ] +# ] +# ] +</pre></div> +</div> +</div> +<div class="section" id="parameters"> +<h2>8.11.6.4. Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline">¶</a></h2> +<p>There are three required parameters, <tt class="docutils literal"><span class="pre">column</span></tt>, <tt class="docutils literal"><span class="pre">normalizer_name</span></tt> and <tt class="docutils literal"><span class="pre">use_html_escape</span></tt>. +There are three or over optional parameters, <tt class="docutils literal"><span class="pre">keywordN</span></tt>, <tt class="docutils literal"><span class="pre">open_tagN</span></tt> and <tt class="docutils literal"><span class="pre">end_tagN</span></tt>.</p> +<div class="section" id="column"> +<h3>8.11.6.4.1. <tt class="docutils literal"><span class="pre">column</span></tt><a class="headerlink" href="#column" title="Permalink to this headline">¶</a></h3> +<p>It specifies a column of the table.</p> +</div> +<div class="section" id="normalizer-name"> +<h3>8.11.6.4.2. <tt class="docutils literal"><span class="pre">normalizer_name</span></tt><a class="headerlink" href="#normalizer-name" title="Permalink to this headline">¶</a></h3> +<p>It specifies a normalizer name.</p> +</div> +<div class="section" id="use-html-escape"> +<h3>8.11.6.4.3. <tt class="docutils literal"><span class="pre">use_html_escape</span></tt><a class="headerlink" href="#use-html-escape" title="Permalink to this headline">¶</a></h3> +<p>It specifies use or not use HTML escape. If it is <tt class="docutils literal"><span class="pre">true</span></tt> , use HTML escape. +If it is <tt class="docutils literal"><span class="pre">false</span></tt> , not use HTML escape.</p> +</div> +<div class="section" id="keywordn"> +<h3>8.11.6.4.4. <tt class="docutils literal"><span class="pre">keywordN</span></tt><a class="headerlink" href="#keywordn" title="Permalink to this headline">¶</a></h3> +<p>It specifies a keyword for tagging. +You can specify multiple keywords for each three arguments.</p> +</div> +<div class="section" id="open-tagn"> +<h3>8.11.6.4.5. <tt class="docutils literal"><span class="pre">open_tagN</span></tt><a class="headerlink" href="#open-tagn" title="Permalink to this headline">¶</a></h3> +<p>It specifies a open tag. +You can specify multiple open tags for each three arguments.</p> +</div> +<div class="section" id="close-tagn"> +<h3>8.11.6.4.6. <tt class="docutils literal"><span class="pre">close_tagN</span></tt><a class="headerlink" href="#close-tagn" title="Permalink to this headline">¶</a></h3> +<p>It specifies a close tag. +You can specify multiple close tags for each three arguments.</p> +</div> +</div> +<div class="section" id="return-value"> +<h2>8.11.6.5. Return value<a class="headerlink" href="#return-value" title="Permalink to this headline">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">highlight_full</span></tt> returns a tagged string or <tt class="docutils literal"><span class="pre">null</span></tt>. If +<tt class="docutils literal"><span class="pre">highlight_full</span></tt> can't find any keywords, it returns <tt class="docutils literal"><span class="pre">null</span></tt>.</p> +</div> +<div class="section" id="see-also"> +<h2>8.11.6.6. See also<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h2> +<ul class="simple"> +<li><a class="reference internal" href="../commands/select.html"><em>select</em></a></li> +<li><a class="reference internal" href="highlight_html.html"><em>highlight_html</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.11.6. highlight_full</a><ul> +<li><a class="reference internal" href="#summary">8.11.6.1. Summary</a></li> +<li><a class="reference internal" href="#syntax">8.11.6.2. Syntax</a></li> +<li><a class="reference internal" href="#usage">8.11.6.3. Usage</a></li> +<li><a class="reference internal" href="#parameters">8.11.6.4. Parameters</a><ul> +<li><a class="reference internal" href="#column">8.11.6.4.1. <tt class="docutils literal"><span class="pre">column</span></tt></a></li> +<li><a class="reference internal" href="#normalizer-name">8.11.6.4.2. <tt class="docutils literal"><span class="pre">normalizer_name</span></tt></a></li> +<li><a class="reference internal" href="#use-html-escape">8.11.6.4.3. <tt class="docutils literal"><span class="pre">use_html_escape</span></tt></a></li> +<li><a class="reference internal" href="#keywordn">8.11.6.4.4. <tt class="docutils literal"><span class="pre">keywordN</span></tt></a></li> +<li><a class="reference internal" href="#open-tagn">8.11.6.4.5. <tt class="docutils literal"><span class="pre">open_tagN</span></tt></a></li> +<li><a class="reference internal" href="#close-tagn">8.11.6.4.6. <tt class="docutils literal"><span class="pre">close_tagN</span></tt></a></li> +</ul> +</li> +<li><a class="reference internal" href="#return-value">8.11.6.5. Return value</a></li> +<li><a class="reference internal" href="#see-also">8.11.6.6. See also</a></li> +</ul> +</li> +</ul> + + <h4>Previous topic</h4> + <p class="topless"><a href="geo_in_rectangle.html" + title="previous chapter">8.11.5. geo_in_rectangle</a></p> + <h4>Next topic</h4> + <p class="topless"><a href="highlight_html.html" + title="next chapter">8.11.7. highlight_html</a></p> + <h3>This Page</h3> + <ul class="this-page-menu"> + <li><a href="../../sources/reference/functions/highlight_full.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="highlight_html.html" title="8.11.7. highlight_html" + >next</a> |</li> + <li class="right" > + <a href="geo_in_rectangle.html" title="8.11.5. geo_in_rectangle" + >previous</a> |</li> + <li><a href="../../index.html">Groonga v4.0.4 documentation</a> »</li> + <li><a href="../../reference.html" >8. Reference manual</a> »</li> + <li><a href="../function.html" >8.11. Function</a> »</li> + </ul> + </div> + <div class="footer"> + © Copyright 2009-2014, 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/functions/highlight_html.html (+304 -0) 100644 =================================================================== --- /dev/null +++ docs/reference/functions/highlight_html.html 2014-08-25 12:22:59 +0900 (e25086c) @@ -0,0 +1,304 @@ +<!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.11.7. highlight_html — Groonga v4.0.4 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: '4.0.4', + 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 v4.0.4 documentation" href="../../index.html" /> + <link rel="up" title="8.11. Function" href="../function.html" /> + <link rel="next" title="8.11.8. html_untag" href="html_untag.html" /> + <link rel="prev" title="8.11.6. highlight_full" href="highlight_full.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/functions/highlight_html.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="html_untag.html" title="8.11.8. html_untag" + accesskey="N">next</a> |</li> + <li class="right" > + <a href="highlight_full.html" title="8.11.6. highlight_full" + accesskey="P">previous</a> |</li> + <li><a href="../../index.html">Groonga v4.0.4 documentation</a> »</li> + <li><a href="../../reference.html" >8. Reference manual</a> »</li> + <li><a href="../function.html" accesskey="U">8.11. Function</a> »</li> + </ul> + </div> + + <div class="document"> + <div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body"> + + <div class="section" id="highlight-html"> +<h1>8.11.7. highlight_html<a class="headerlink" href="#highlight-html" title="Permalink to this headline">¶</a></h1> +<div class="admonition caution"> +<p class="first admonition-title">Caution</p> +<p class="last">This feature is experimental. API will be changed.</p> +</div> +<div class="section" id="summary"> +<h2>8.11.7.1. Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">highlight_html</span></tt> tags target text. It can use to highlight the search +keywords. The tagged text are prepared for embedding HTML. Special +characters such as <tt class="docutils literal"><span class="pre"><</span></tt> and <tt class="docutils literal"><span class="pre">></span></tt> are escapsed as <tt class="docutils literal"><span class="pre">&lt;</span></tt> and <tt class="docutils literal"><span class="pre">&gt;</span></tt>. +Keyword is surrounded with <tt class="docutils literal"><span class="pre"><span</span> <span class="pre">class="keyword"></span></tt> and <tt class="docutils literal"><span class="pre"></span></span></tt>. +For example, a tagged text of <tt class="docutils literal"><span class="pre">I</span> <span class="pre">am</span> <span class="pre">a</span> <span class="pre">groonga</span> <span class="pre">user.</span> <span class="pre"><3</span></tt> for keyword +<tt class="docutils literal"><span class="pre">groonga</span></tt> is <tt class="docutils literal"><span class="pre">I</span> <span class="pre">am</span> <span class="pre">a</span> <span class="pre"><span</span> <span class="pre">class="keyword">groonga</span></span> <span class="pre">user.</span> <span class="pre">&lt;3</span></tt>.</p> +</div> +<div class="section" id="syntax"> +<h2>8.11.7.2. Syntax<a class="headerlink" href="#syntax" title="Permalink to this headline">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">highlight_html</span></tt> has only one parameter:</p> +<div class="highlight-none"><div class="highlight"><pre>highlight_html(column) +</pre></div> +</div> +</div> +<div class="section" id="usage"> +<h2>8.11.7.3. Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2> +<p>Here are a schema definition and sample data to show usage.</p> +<p>Execution example:</p> +<div class="highlight-none"><div class="highlight"><pre>table_create Entries TABLE_NO_KEY +# [[0,1407692435.35498,0.0364797115325928],true] +column_create Entries body COLUMN_SCALAR ShortText +# [[0,1407692435.39156,0.0256640911102295],true] +table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +# [[0,1407692435.423,0.0274741649627686],true] +column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body +# [[0,1407692435.45051,0.0534985065460205],true] +load --table Entries +[ +{"body": "Mroonga is a MySQL storage engine based on Groonga. <b>Rroonga</b> is a Ruby binding of Groonga."} +] +# [[0,1407692435.50406,0.378907442092896],1] +</pre></div> +</div> +<p><tt class="docutils literal"><span class="pre">highlight_html</span></tt> can be used in only <tt class="docutils literal"><span class="pre">--output_columns</span></tt> in +<a class="reference internal" href="../commands/select.html"><em>select</em></a>.</p> +<p><tt class="docutils literal"><span class="pre">highlight_html</span></tt> requires Groonga 4.0.5 or later.</p> +<p><tt class="docutils literal"><span class="pre">highlight_html</span></tt> requires <a class="reference internal" href="../command/command_version.html"><em>コマンドバージョン</em></a> 2 +or later.</p> +<p>You also need to specify <tt class="docutils literal"><span class="pre">--query</span></tt> and/or <tt class="docutils literal"><span class="pre">--filter</span></tt>. Keywords are +extracted from <tt class="docutils literal"><span class="pre">--query</span></tt> and <tt class="docutils literal"><span class="pre">--filter</span></tt> arguments.</p> +<p>The following example uses <tt class="docutils literal"><span class="pre">--query</span> <span class="pre">"groonga</span> <span class="pre">mysql"</span></tt>. In this case, +<tt class="docutils literal"><span class="pre">groonga</span></tt> and <tt class="docutils literal"><span class="pre">mysql</span></tt> are used as keywords.</p> +<p>Execution example:</p> +<div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns --match_columns body --query 'groonga mysql' --output_columns 'highlight_html(body)' --command_version 2 +# [ +# [ +# 0, +# 1407692444.86092, +# 0.00188779830932617 +# ], +# [ +# [ +# [ +# 1 +# ], +# [ +# [ +# "highlight_html", +# "null" +# ] +# ], +# [ +# "Mroonga is a <span class=\"keyword\">MySQL</span> storage engine based on <span class=\"keyword\">Groonga</span>. &lt;b&gt;Rroonga&lt;/b&gt; is a Ruby binding of <span class=\"keyword\">Groonga</span>." +# ] +# ] +# ] +# ] +</pre></div> +</div> +<p>The text are scanned by the keywords for tagging after they are normalized +by <tt class="docutils literal"><span class="pre">NormalizerAuto</span></tt> normalizer.</p> +<p><tt class="docutils literal"><span class="pre">--query</span> <span class="pre">"groonga</span> <span class="pre">mysql"</span></tt> matches to only the first record's body. +<tt class="docutils literal"><span class="pre">highlight_html(body)</span></tt> surrounds the keywords <tt class="docutils literal"><span class="pre">groonga</span></tt> or <tt class="docutils literal"><span class="pre">mysql</span></tt> +contained in the text with <tt class="docutils literal"><span class="pre"><span</span> <span class="pre">class="keyword"></span></tt> and <tt class="docutils literal"><span class="pre"></span></span></tt>.</p> +<p>You can specify string literal instead of column.</p> +<p>Execution example:</p> +<div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns 'highlight_html("Groonga is very fast fulltext search engine.")' --command_version 2 --match_columns body --query "groonga" +# [ +# [ +# 0, +# 1407693081.99183, +# 0.000126123428344727 +# ], +# [ +# [ +# [ +# 1 +# ], +# [ +# [ +# "highlight_html", +# "null" +# ] +# ], +# [ +# "<span class=\"keyword\">Groonga</span> is very fast fulltext search engine." +# ] +# ] +# ] +# ] +</pre></div> +</div> +</div> +<div class="section" id="parameters"> +<h2>8.11.7.4. Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline">¶</a></h2> +<p>There is only one parameter <tt class="docutils literal"><span class="pre">column</span></tt> .</p> +<div class="section" id="column"> +<h3>8.11.7.4.1. <tt class="docutils literal"><span class="pre">column</span></tt><a class="headerlink" href="#column" title="Permalink to this headline">¶</a></h3> +<p>It specifies a column of the table.</p> +</div> +</div> +<div class="section" id="return-value"> +<h2>8.11.7.5. Return value<a class="headerlink" href="#return-value" title="Permalink to this headline">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">highlight_html</span></tt> returns a tagged string or <tt class="docutils literal"><span class="pre">null</span></tt>. If +<tt class="docutils literal"><span class="pre">highlight_html</span></tt> can't find any keywords, it returns <tt class="docutils literal"><span class="pre">null</span></tt>.</p> +</div> +<div class="section" id="see-also"> +<h2>8.11.7.6. See also<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h2> +<ul class="simple"> +<li><a class="reference internal" href="../commands/select.html"><em>select</em></a></li> +<li><a class="reference internal" href="highlight_full.html"><em>highlight_full</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.11.7. highlight_html</a><ul> +<li><a class="reference internal" href="#summary">8.11.7.1. Summary</a></li> +<li><a class="reference internal" href="#syntax">8.11.7.2. Syntax</a></li> +<li><a class="reference internal" href="#usage">8.11.7.3. Usage</a></li> +<li><a class="reference internal" href="#parameters">8.11.7.4. Parameters</a><ul> +<li><a class="reference internal" href="#column">8.11.7.4.1. <tt class="docutils literal"><span class="pre">column</span></tt></a></li> +</ul> +</li> +<li><a class="reference internal" href="#return-value">8.11.7.5. Return value</a></li> +<li><a class="reference internal" href="#see-also">8.11.7.6. See also</a></li> +</ul> +</li> +</ul> + + <h4>Previous topic</h4> + <p class="topless"><a href="highlight_full.html" + title="previous chapter">8.11.6. highlight_full</a></p> + <h4>Next topic</h4> + <p class="topless"><a href="html_untag.html" + title="next chapter">8.11.8. html_untag</a></p> + <h3>This Page</h3> + <ul class="this-page-menu"> + <li><a href="../../sources/reference/functions/highlight_html.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="html_untag.html" title="8.11.8. html_untag" + >next</a> |</li> + <li class="right" > + <a href="highlight_full.html" title="8.11.6. highlight_full" + >previous</a> |</li> + <li><a href="../../index.html">Groonga v4.0.4 documentation</a> »</li> + <li><a href="../../reference.html" >8. Reference manual</a> »</li> + <li><a href="../function.html" >8.11. Function</a> »</li> + </ul> + </div> + <div class="footer"> + © Copyright 2009-2014, 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/functions/highlight_full.txt (+132 -0) 100644 =================================================================== --- /dev/null +++ docs/sources/reference/functions/highlight_full.txt 2014-08-25 12:22:59 +0900 (0b919a2) @@ -0,0 +1,132 @@ +.. -*- rst -*- + +.. highlightlang:: none + +.. groonga-command +.. database: functions_highlight_full + +highlight_full +============== + +.. caution:: + + This feature is experimental. API will be changed. + +Summary +------- + +``highlight_full`` tags target text. It can use to highlight the search +keyword. It can specify use/not use HTML escape, the normalizer name and +change the tag for each keyword. + +Syntax +------ + +``highlight_full`` has required parameter and optional parameter:: + + highlight_full(column, normalizer_name, use_html_escape, + keyword1, open_tag1, close_tag1, + ... + [keywordN, open_tagN, close_tagN]) + +Usage +----- + +Here are a schema definition and sample data to show usage. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_full/usage_setup.log +.. table_create Entries TABLE_NO_KEY +.. column_create Entries body COLUMN_SCALAR ShortText +.. table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +.. column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body +.. load --table Entries +.. [ +.. ["content"], +.. {"body": "Mroonga is a MySQL storage engine based on Groonga. <b>Rroonga</b> is a Ruby binding of Groonga."} +.. ] + +``highlight_full`` can be used in only ``--output_columns`` in +:doc:`/reference/commands/select`. + +``highlight_full`` requires Groonga 4.0.5 or later. + +``highlight_full`` requires :doc:`/reference/command/command_version` 2 +or later. + +The following example uses HTML escape and normalzier is ``NormalizeAuto``. +It specifies the tags ``<span class="keyword1">`` and ``</span>`` of the +keyword ``groonga``, and the tags ``<span class="keyword2">`` and ``</span>`` +of the keyword ``mysql``. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_full/usage_basic.log +.. select Entries --output_columns 'highlight_full(body, "NormalizerAuto", true, "Groonga", "<span class=\\"keyword1\\">", "</span>", "mysql", "<span class=\\"keyword2\\">", "</span>")' --command_version 2 + +The text are scanned by the keywords for tagging after they are normalized +by ``NormalizerAuto`` normalizer. + +``--query "groonga mysql"`` matches to the first record's body. +``highight_full`` surrounds the keywords ``groonga`` contained in the text +with ``<span class="keyword1">`` and ``</span>``, and the keywords ``mysql`` +contained in the text with with ``<span class="keyword2">`` and ``</span>``. + +Special characters such as ``<`` and ``>`` are escapsed as ``<`` and +``>``. + +You can specify string literal instead of column. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_full/usage_string_literal.log +.. select Entries --output_columns 'highlight_full("Groonga is very fast fulltext search engine.", "NormalizerAuto", true, "Groonga", "<span class=\\"keyword1\\">", "</span>", "mysql", "<span class=\\"keyword2\\">", "</span>")' --command_version 2 --match_columns body --query "groonga" + +Parameters +---------- +There are three required parameters, ``column``, ``normalizer_name`` and ``use_html_escape``. +There are three or over optional parameters, ``keywordN``, ``open_tagN`` and ``end_tagN``. + +``column`` +^^^^^^^^^^ + +It specifies a column of the table. + +``normalizer_name`` +^^^^^^^^^^^^^^^^^^^ + +It specifies a normalizer name. + +``use_html_escape`` +^^^^^^^^^^^^^^^^^^^ + +It specifies use or not use HTML escape. If it is ``true`` , use HTML escape. +If it is ``false`` , not use HTML escape. + +``keywordN`` +^^^^^^^^^^^^ + +It specifies a keyword for tagging. +You can specify multiple keywords for each three arguments. + +``open_tagN`` +^^^^^^^^^^^^^ + +It specifies a open tag. +You can specify multiple open tags for each three arguments. + +``close_tagN`` +^^^^^^^^^^^^^^ + +It specifies a close tag. +You can specify multiple close tags for each three arguments. + +Return value +------------ + +``highlight_full`` returns a tagged string or ``null``. If +``highlight_full`` can't find any keywords, it returns ``null``. + +See also +-------- + +* :doc:`/reference/commands/select` +* :doc:`/reference/functions/highlight_html` Added: docs/sources/reference/functions/highlight_html.txt (+100 -0) 100644 =================================================================== --- /dev/null +++ docs/sources/reference/functions/highlight_html.txt 2014-08-25 12:22:59 +0900 (533a5bf) @@ -0,0 +1,100 @@ +.. -*- rst -*- + +.. highlightlang:: none + +.. groonga-command +.. database: functions_highlight_html + +highlight_html +============== + +.. caution:: + + This feature is experimental. API will be changed. + +Summary +------- + +``highlight_html`` tags target text. It can use to highlight the search +keywords. The tagged text are prepared for embedding HTML. Special +characters such as ``<`` and ``>`` are escapsed as ``<`` and ``>``. +Keyword is surrounded with ``<span class="keyword">`` and ``</span>``. +For example, a tagged text of ``I am a groonga user. <3`` for keyword +``groonga`` is ``I am a <span class="keyword">groonga</span> user. <3``. + +Syntax +------ + +``highlight_html`` has only one parameter:: + + highlight_html(column) + +Usage +----- + +Here are a schema definition and sample data to show usage. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_html/usage_setup.log +.. table_create Entries TABLE_NO_KEY +.. column_create Entries body COLUMN_SCALAR ShortText +.. table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +.. column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body +.. load --table Entries +.. [ +.. ["content"], +.. {"body": "Mroonga is a MySQL storage engine based on Groonga. <b>Rroonga</b> is a Ruby binding of Groonga."} +.. ] + +``highlight_html`` can be used in only ``--output_columns`` in +:doc:`/reference/commands/select`. + +``highlight_html`` requires Groonga 4.0.5 or later. + +``highlight_html`` requires :doc:`/reference/command/command_version` 2 +or later. + +You also need to specify ``--query`` and/or ``--filter``. Keywords are +extracted from ``--query`` and ``--filter`` arguments. + +The following example uses ``--query "groonga mysql"``. In this case, +``groonga`` and ``mysql`` are used as keywords. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_html/usage_basic.log +.. select Entries --output_columns --match_columns body --query 'groonga mysql' --output_columns 'highlight_html(body)' --command_version 2 + +The text are scanned by the keywords for tagging after they are normalized +by ``NormalizerAuto`` normalizer. + +``--query "groonga mysql"`` matches to only the first record's body. +``highlight_html(body)`` surrounds the keywords ``groonga`` or ``mysql`` +contained in the text with ``<span class="keyword">`` and ``</span>``. + +You can specify string literal instead of column. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_html/usage_string_literal.log +.. select Entries --output_columns 'highlight_html("Groonga is very fast fulltext search engine.")' --command_version 2 --match_columns body --query "groonga" + +Parameters +---------- + +There is only one parameter ``column`` . + +``column`` +^^^^^^^^^^ + +It specifies a column of the table. + +Return value +------------ + +``highlight_html`` returns a tagged string or ``null``. If +``highlight_html`` can't find any keywords, it returns ``null``. + +See also +-------- + +* :doc:`/reference/commands/select` +* :doc:`/reference/functions/highlight_full` Added: ja/docs/reference/functions/highlight_full.html (+320 -0) 100644 =================================================================== --- /dev/null +++ ja/docs/reference/functions/highlight_full.html 2014-08-25 12:22:59 +0900 (fa7fe1c) @@ -0,0 +1,320 @@ +<!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.11.6. highlight_full — Groonga v4.0.4ドキュメント</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: '4.0.4', + 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 v4.0.4ドキュメント" href="../../index.html" /> + <link rel="up" title="8.11. 関数" href="../function.html" /> + <link rel="next" title="8.11.7. highlight_html" href="highlight_html.html" /> + <link rel="prev" title="8.11.5. geo_in_rectangle" href="geo_in_rectangle.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/functions/highlight_full.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="highlight_html.html" title="8.11.7. highlight_html" + accesskey="N">次へ</a> |</li> + <li class="right" > + <a href="geo_in_rectangle.html" title="8.11.5. geo_in_rectangle" + accesskey="P">前へ</a> |</li> + <li><a href="../../index.html">Groonga v4.0.4ドキュメント</a> »</li> + <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> + <li><a href="../function.html" accesskey="U">8.11. 関数</a> »</li> + </ul> + </div> + + <div class="document"> + <div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body"> + + <div class="section" id="highlight-full"> +<h1>8.11.6. highlight_full<a class="headerlink" href="#highlight-full" title="このヘッドラインへのパーマリンク">¶</a></h1> +<div class="admonition caution"> +<p class="first admonition-title">ご用心</p> +<p class="last">この機能は実験的です。APIが変わる可能性があります。</p> +</div> +<div class="section" id="summary"> +<h2>8.11.6.1. 概要<a class="headerlink" href="#summary" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">highlight_full</span></tt> は対象テキストをタグ付けします。検索文字列をハイライトさせるために利用することができます。HTMLエスケープの有無、ノーマライザー名を指定することができ、キーワードごとにタグを変更することができます。</p> +</div> +<div class="section" id="syntax"> +<h2>8.11.6.2. 構文<a class="headerlink" href="#syntax" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">highlight_full</span></tt> には必須引数と省略可能引数とがあります:</p> +<div class="highlight-none"><div class="highlight"><pre>highlight_full(column, normalizer_name, use_html_escape, + keyword1, open_tag1, close_tag1, + ... + [keywordN, open_tagN, close_tagN]) +</pre></div> +</div> +</div> +<div class="section" id="usage"> +<h2>8.11.6.3. 使い方<a class="headerlink" href="#usage" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p>使い方を示すために使うスキーマ定義とサンプルデータは以下の通りです。</p> +<p>実行例:</p> +<div class="highlight-none"><div class="highlight"><pre>table_create Entries TABLE_NO_KEY +# [[0,1407692435.35498,0.0364797115325928],true] +column_create Entries body COLUMN_SCALAR ShortText +# [[0,1407692435.39156,0.0256640911102295],true] +table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +# [[0,1407692435.423,0.0274741649627686],true] +column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body +# [[0,1407692435.45051,0.0534985065460205],true] +load --table Entries +[ +{"body": "Mroonga is a MySQL storage engine based on Groonga. <b>Rroonga</b> is a Ruby binding of Groonga."} +] +# [[0,1407692435.50406,0.378907442092896],1] +</pre></div> +</div> +<p><tt class="docutils literal"><span class="pre">highlight_full</span></tt> は <a class="reference internal" href="../commands/select.html"><em>select</em></a> コマンドの <tt class="docutils literal"><span class="pre">--output_columns</span></tt> 内でのみ指定できます。</p> +<p><tt class="docutils literal"><span class="pre">highlight_full</span></tt> を使うにはGroonga 4.0.5以降が必要です。</p> +<p><tt class="docutils literal"><span class="pre">highlight_full</span></tt> を使うには コマンドバージョン 2以降を使う必要があります。</p> +<p>以下の例はHTMLエスケープを使用し、ノーマライザーに <tt class="docutils literal"><span class="pre">NormalizerAuto</span></tt> を指定しています。この例では キーワード <tt class="docutils literal"><span class="pre">groonga</span></tt> に <tt class="docutils literal"><span class="pre"><span</span> <span class="pre">class="keyword1"></span></tt> と <tt class="docutils literal"><span class="pre"></span></span></tt> のタグを指定し、キーワード <tt class="docutils literal"><span class="pre">mysql</span></tt> に <tt class="docutils literal"><span class="pre"><span</span> <span class="pre">class="keyword2"></span></tt> と <tt class="docutils literal"><span class="pre"></span></span></tt> のタグを指定しています。</p> +<p>実行例:</p> +<div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns 'highlight_full(body, "NormalizerAuto", true, "Groonga", "<span class=\\"keyword1\\">", "</span>", "mysql", "<span class=\\"keyword2\\">", "</span>")' --command_version 2 +# [ +# [ +# 0, +# 1407695996.52987, +# 0.00151872634887695 +# ], +# [ +# [ +# [ +# 1 +# ], +# [ +# [ +# "highlight_full", +# "null" +# ] +# ], +# [ +# "Mroonga is a <span class=\"keyword2\">MySQL</span> storage engine based on <span class=\"keyword1\">Groonga</span>. &lt;b&gt;Rroonga&lt;/b&gt; is a Ruby binding of <span class=\"keyword1\">Groonga</span>." +# ] +# ] +# ] +# ] +</pre></div> +</div> +<p>キーワードとテキストは <tt class="docutils literal"><span class="pre">NormalizerAuto</span></tt> ノーマライザーで正規化されてタグ付けのためにスキャンされます。</p> +<p><tt class="docutils literal"><span class="pre">--query</span> <span class="pre">"groonga</span> <span class="pre">mysql"</span></tt> は最初のレコードにマッチします。 <tt class="docutils literal"><span class="pre">highlight_full</span></tt> は、テキスト中に含まれるキーワード <tt class="docutils literal"><span class="pre">groonga</span></tt> を <tt class="docutils literal"><span class="pre"><span</span> <span class="pre">class="keyword1"></span></tt> と <tt class="docutils literal"><span class="pre"></span></span></tt> で囲み、 キーワード <tt class="docutils literal"><span class="pre">mysql</span></tt> を <tt class="docutils literal"><span class="pre"><span</span> <span class="pre">class="keyword2"></span></tt> と <tt class="docutils literal"><span class="pre"></span></span></tt> で囲みます。</p> +<p><tt class="docutils literal"><span class="pre"><</span></tt> や <tt class="docutils literal"><span class="pre">></span></tt> などの特殊文字は &lt; や &gt; にエスケープされています。</p> +<p>カラムの代わりに文字列リテラルを指定することもできます。</p> +<p>実行例:</p> +<div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns 'highlight_full("Groonga is very fast fulltext search engine.", "NormalizerAuto", true, "Groonga", "<span class=\\"keyword1\\">", "</span>", "mysql", "<span class=\\"keyword2\\">", "</span>")' --command_version 2 --match_columns body --query "groonga" +# [ +# [ +# 0, +# 1407696157.1849, +# 0.00164437294006348 +# ], +# [ +# [ +# [ +# 1 +# ], +# [ +# [ +# "highlight_full", +# "null" +# ] +# ], +# [ +# "<span class=\"keyword1\">Groonga</span> is very fast fulltext search engine." +# ] +# ] +# ] +# ] +</pre></div> +</div> +</div> +<div class="section" id="parameters"> +<h2>8.11.6.4. 引数<a class="headerlink" href="#parameters" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p>必須引数は3つあります。 <tt class="docutils literal"><span class="pre">column</span></tt> と <tt class="docutils literal"><span class="pre">normalizer_name</span></tt> と <tt class="docutils literal"><span class="pre">use_html_escape</span></tt> です。省略可能引数は3つ以上あります。 <tt class="docutils literal"><span class="pre">keywordN</span></tt> と <tt class="docutils literal"><span class="pre">open_tagN</span></tt> と <tt class="docutils literal"><span class="pre">end_tagN</span></tt> です。</p> +<div class="section" id="column"> +<h3>8.11.6.4.1. <tt class="docutils literal"><span class="pre">column</span></tt><a class="headerlink" href="#column" title="このヘッドラインへのパーマリンク">¶</a></h3> +<p>テーブルのカラムを指定します。</p> +</div> +<div class="section" id="normalizer-name"> +<h3>8.11.6.4.2. <tt class="docutils literal"><span class="pre">normalizer_name</span></tt><a class="headerlink" href="#normalizer-name" title="このヘッドラインへのパーマリンク">¶</a></h3> +<p>ノーマライザー名を指定します。</p> +</div> +<div class="section" id="use-html-escape"> +<h3>8.11.6.4.3. <tt class="docutils literal"><span class="pre">use_html_escape</span></tt><a class="headerlink" href="#use-html-escape" title="このヘッドラインへのパーマリンク">¶</a></h3> +<p>HTMLエスケープの有無を指定します。 <tt class="docutils literal"><span class="pre">true</span></tt> を指定すればHTMLエスケープされます。 <tt class="docutils literal"><span class="pre">false</span></tt> を指定すればHTMLエスケープされません。</p> +</div> +<div class="section" id="keywordn"> +<h3>8.11.6.4.4. <tt class="docutils literal"><span class="pre">keywordN</span></tt><a class="headerlink" href="#keywordn" title="このヘッドラインへのパーマリンク">¶</a></h3> +<p>タグ付けするキーワードを指定します。3つの引数ごとに複数のキーワードを指定することができます。</p> +</div> +<div class="section" id="open-tagn"> +<h3>8.11.6.4.5. <tt class="docutils literal"><span class="pre">open_tagN</span></tt><a class="headerlink" href="#open-tagn" title="このヘッドラインへのパーマリンク">¶</a></h3> +<p>開始タグを指定します。3つの引数ごとに複数の開始タグを指定することができます。</p> +</div> +<div class="section" id="close-tagn"> +<h3>8.11.6.4.6. <tt class="docutils literal"><span class="pre">close_tagN</span></tt><a class="headerlink" href="#close-tagn" title="このヘッドラインへのパーマリンク">¶</a></h3> +<p>終了タグを指定します。3つの引数ごとに複数の終了タグを指定することができます。</p> +</div> +</div> +<div class="section" id="return-value"> +<h2>8.11.6.5. 戻り値<a class="headerlink" href="#return-value" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">highlight_full</span></tt> はタグ付の文字列もしくは null を返します。<tt class="docutils literal"><span class="pre">highlight_full</span></tt> は該当するキーワードがない場合に null を返します。</p> +</div> +<div class="section" id="see-also"> +<h2>8.11.6.6. 参考<a class="headerlink" href="#see-also" title="このヘッドラインへのパーマリンク">¶</a></h2> +<ul class="simple"> +<li><a class="reference internal" href="../commands/select.html"><em>select</em></a></li> +<li><a class="reference internal" href="highlight_html.html"><em>highlight_html</em></a></li> +</ul> +</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.11.6. highlight_full</a><ul> +<li><a class="reference internal" href="#summary">8.11.6.1. 概要</a></li> +<li><a class="reference internal" href="#syntax">8.11.6.2. 構文</a></li> +<li><a class="reference internal" href="#usage">8.11.6.3. 使い方</a></li> +<li><a class="reference internal" href="#parameters">8.11.6.4. 引数</a><ul> +<li><a class="reference internal" href="#column">8.11.6.4.1. <tt class="docutils literal"><span class="pre">column</span></tt></a></li> +<li><a class="reference internal" href="#normalizer-name">8.11.6.4.2. <tt class="docutils literal"><span class="pre">normalizer_name</span></tt></a></li> +<li><a class="reference internal" href="#use-html-escape">8.11.6.4.3. <tt class="docutils literal"><span class="pre">use_html_escape</span></tt></a></li> +<li><a class="reference internal" href="#keywordn">8.11.6.4.4. <tt class="docutils literal"><span class="pre">keywordN</span></tt></a></li> +<li><a class="reference internal" href="#open-tagn">8.11.6.4.5. <tt class="docutils literal"><span class="pre">open_tagN</span></tt></a></li> +<li><a class="reference internal" href="#close-tagn">8.11.6.4.6. <tt class="docutils literal"><span class="pre">close_tagN</span></tt></a></li> +</ul> +</li> +<li><a class="reference internal" href="#return-value">8.11.6.5. 戻り値</a></li> +<li><a class="reference internal" href="#see-also">8.11.6.6. 参考</a></li> +</ul> +</li> +</ul> + + <h4>前のトピックへ</h4> + <p class="topless"><a href="geo_in_rectangle.html" + title="前の章へ">8.11.5. geo_in_rectangle</a></p> + <h4>次のトピックへ</h4> + <p class="topless"><a href="highlight_html.html" + title="次の章へ">8.11.7. highlight_html</a></p> + <h3>このページ</h3> + <ul class="this-page-menu"> + <li><a href="../../sources/reference/functions/highlight_full.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="highlight_html.html" title="8.11.7. highlight_html" + >次へ</a> |</li> + <li class="right" > + <a href="geo_in_rectangle.html" title="8.11.5. geo_in_rectangle" + >前へ</a> |</li> + <li><a href="../../index.html">Groonga v4.0.4ドキュメント</a> »</li> + <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> + <li><a href="../function.html" >8.11. 関数</a> »</li> + </ul> + </div> + <div class="footer"> + © Copyright 2009-2014, 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/functions/highlight_html.html (+292 -0) 100644 =================================================================== --- /dev/null +++ ja/docs/reference/functions/highlight_html.html 2014-08-25 12:22:59 +0900 (4c74065) @@ -0,0 +1,292 @@ +<!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.11.7. highlight_html — Groonga v4.0.4ドキュメント</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: '4.0.4', + 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 v4.0.4ドキュメント" href="../../index.html" /> + <link rel="up" title="8.11. 関数" href="../function.html" /> + <link rel="next" title="8.11.8. html_untag" href="html_untag.html" /> + <link rel="prev" title="8.11.6. highlight_full" href="highlight_full.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/functions/highlight_html.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="html_untag.html" title="8.11.8. html_untag" + accesskey="N">次へ</a> |</li> + <li class="right" > + <a href="highlight_full.html" title="8.11.6. highlight_full" + accesskey="P">前へ</a> |</li> + <li><a href="../../index.html">Groonga v4.0.4ドキュメント</a> »</li> + <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> + <li><a href="../function.html" accesskey="U">8.11. 関数</a> »</li> + </ul> + </div> + + <div class="document"> + <div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body"> + + <div class="section" id="highlight-html"> +<h1>8.11.7. highlight_html<a class="headerlink" href="#highlight-html" title="このヘッドラインへのパーマリンク">¶</a></h1> +<div class="admonition caution"> +<p class="first admonition-title">ご用心</p> +<p class="last">この機能は実験的です。APIが変わる可能性があります。</p> +</div> +<div class="section" id="summary"> +<h2>8.11.7.1. 概要<a class="headerlink" href="#summary" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">highlight_html</span></tt> は対象テキストをタグ付けします。検索文字列をハイライトさせるために利用することができます。タグ付けされたテキストはHTML中に埋め込みやすいように処理されています。<tt class="docutils literal"><span class="pre"><</span></tt> や <tt class="docutils literal"><span class="pre">></span></tt> などの特殊文字は &lt; や &gt; にエスケープされています。キーワードは <tt class="docutils literal"><span class="pre"><span</span> <span class="pre">class="keyword"></span></tt> と <tt class="docutils literal"><span class="pre"></span></span></tt> で囲まれています。たとえば、 <tt class="docutils literal"><span class="pre">I</span> <span class="pre">am</span> <span class="pre">a</span> <span class="pre">groonga</span> <span class="pre">user.</span> <span class="pre">& lt;3</sp an></tt> という対象テキストのキーワード <tt class="docutils literal"><span class="pre">groonga</span></tt> でタグ付けされたテキストは <tt class="docutils literal"><span class="pre">I</span> <span class="pre">am</span> <span class="pre">a</span> <span class="pre"><span</span> <span class="pre">class="keyword">groonga</span></span> <span class="pre">user.</span> <span class="pre">&lt;3</span></tt> となります。</p> +</div> +<div class="section" id="syntax"> +<h2>8.11.7.2. 構文<a class="headerlink" href="#syntax" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">highlight_html</span></tt> の引数は1つだけです:</p> +<div class="highlight-none"><div class="highlight"><pre>highlight_html(column) +</pre></div> +</div> +</div> +<div class="section" id="usage"> +<h2>8.11.7.3. 使い方<a class="headerlink" href="#usage" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p>使い方を示すために使うスキーマ定義とサンプルデータは以下の通りです。</p> +<p>実行例:</p> +<div class="highlight-none"><div class="highlight"><pre>table_create Entries TABLE_NO_KEY +# [[0,1407692435.35498,0.0364797115325928],true] +column_create Entries body COLUMN_SCALAR ShortText +# [[0,1407692435.39156,0.0256640911102295],true] +table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +# [[0,1407692435.423,0.0274741649627686],true] +column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body +# [[0,1407692435.45051,0.0534985065460205],true] +load --table Entries +[ +{"body": "Mroonga is a MySQL storage engine based on Groonga. <b>Rroonga</b> is a Ruby binding of Groonga."} +] +# [[0,1407692435.50406,0.378907442092896],1] +</pre></div> +</div> +<p><tt class="docutils literal"><span class="pre">highlight_html</span></tt> は <a class="reference internal" href="../commands/select.html"><em>select</em></a> コマンドの <tt class="docutils literal"><span class="pre">--output_columns</span></tt> 内でのみ指定できます。</p> +<p><tt class="docutils literal"><span class="pre">highlight_html</span></tt> を使うにはGroonga 4.0.5以降が必要です。</p> +<p><tt class="docutils literal"><span class="pre">highlight_html</span></tt> を使うには コマンドバージョン 2以降を使う必要があります。</p> +<p>また、 <tt class="docutils literal"><span class="pre">--query</span></tt> と <tt class="docutils literal"><span class="pre">--filter</span></tt> オプションも指定する必要があります。(どちらか一方でも構いません。)これは、 <tt class="docutils literal"><span class="pre">--query</span></tt> と <tt class="docutils literal"><span class="pre">--filter</span></tt> オプションからキーワードを抽出しているためです。</p> +<p>以下の例は <tt class="docutils literal"><span class="pre">--query</span> <span class="pre">"groonga</span> <span class="pre">mysql"</span></tt> を使っています。この場合は、キーワードとして <tt class="docutils literal"><span class="pre">groonga</span></tt> と <tt class="docutils literal"><span class="pre">mysql</span></tt> を使います。</p> +<p>実行例:</p> +<div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns --match_columns body --query 'groonga mysql' --output_columns 'highlight_html(body)' --command_version 2 +# [ +# [ +# 0, +# 1407692444.86092, +# 0.00188779830932617 +# ], +# [ +# [ +# [ +# 1 +# ], +# [ +# [ +# "highlight_html", +# "null" +# ] +# ], +# [ +# "Mroonga is a <span class=\"keyword\">MySQL</span> storage engine based on <span class=\"keyword\">Groonga</span>. &lt;b&gt;Rroonga&lt;/b&gt; is a Ruby binding of <span class=\"keyword\">Groonga</span>." +# ] +# ] +# ] +# ] +</pre></div> +</div> +<p>キーワードとテキストは <tt class="docutils literal"><span class="pre">NormalizerAuto</span></tt> ノーマライザーで正規化されてタグ付けのためにスキャンされます。</p> +<p><tt class="docutils literal"><span class="pre">--query</span> <span class="pre">"groonga</span> <span class="pre">mysql"</span></tt> は最初のレコードにマッチします。<tt class="docutils literal"><span class="pre">highlight_html(body)</span></tt> は、テキスト中に含まれるキーワード <tt class="docutils literal"><span class="pre">groonga</span></tt> と <tt class="docutils literal"><span class="pre">mysql</span></tt> を <tt class="docutils literal"><span class="pre"><span</span> <span class="pre">class="keyword"></span></tt> と <tt class="docutils literal"><span class="pre"></span></span></tt> で囲みます。</p> +<p>カラムの代わりに文字列リテラルを指定することもできます。</p> +<p>実行例:</p> +<div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns 'highlight_html("Groonga is very fast fulltext search engine.")' --command_version 2 --match_columns body --query "groonga" +# [ +# [ +# 0, +# 1407693081.99183, +# 0.000126123428344727 +# ], +# [ +# [ +# [ +# 1 +# ], +# [ +# [ +# "highlight_html", +# "null" +# ] +# ], +# [ +# "<span class=\"keyword\">Groonga</span> is very fast fulltext search engine." +# ] +# ] +# ] +# ] +</pre></div> +</div> +</div> +<div class="section" id="parameters"> +<h2>8.11.7.4. 引数<a class="headerlink" href="#parameters" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p>引数は1つあります。 <tt class="docutils literal"><span class="pre">column</span></tt> です。</p> +<div class="section" id="column"> +<h3>8.11.7.4.1. <tt class="docutils literal"><span class="pre">column</span></tt><a class="headerlink" href="#column" title="このヘッドラインへのパーマリンク">¶</a></h3> +<p>テーブルのカラムを指定します。</p> +</div> +</div> +<div class="section" id="return-value"> +<h2>8.11.7.5. 戻り値<a class="headerlink" href="#return-value" title="このヘッドラインへのパーマリンク">¶</a></h2> +<p><tt class="docutils literal"><span class="pre">highlight_html</span></tt> はタグ付の文字列もしくは null を返します。<tt class="docutils literal"><span class="pre">highlight_html</span></tt> は該当するキーワードがない場合に null を返します。</p> +</div> +<div class="section" id="see-also"> +<h2>8.11.7.6. 参考<a class="headerlink" href="#see-also" title="このヘッドラインへのパーマリンク">¶</a></h2> +<ul class="simple"> +<li><a class="reference internal" href="../commands/select.html"><em>select</em></a></li> +<li><a class="reference internal" href="highlight_full.html"><em>highlight_full</em></a></li> +</ul> +</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.11.7. highlight_html</a><ul> +<li><a class="reference internal" href="#summary">8.11.7.1. 概要</a></li> +<li><a class="reference internal" href="#syntax">8.11.7.2. 構文</a></li> +<li><a class="reference internal" href="#usage">8.11.7.3. 使い方</a></li> +<li><a class="reference internal" href="#parameters">8.11.7.4. 引数</a><ul> +<li><a class="reference internal" href="#column">8.11.7.4.1. <tt class="docutils literal"><span class="pre">column</span></tt></a></li> +</ul> +</li> +<li><a class="reference internal" href="#return-value">8.11.7.5. 戻り値</a></li> +<li><a class="reference internal" href="#see-also">8.11.7.6. 参考</a></li> +</ul> +</li> +</ul> + + <h4>前のトピックへ</h4> + <p class="topless"><a href="highlight_full.html" + title="前の章へ">8.11.6. highlight_full</a></p> + <h4>次のトピックへ</h4> + <p class="topless"><a href="html_untag.html" + title="次の章へ">8.11.8. html_untag</a></p> + <h3>このページ</h3> + <ul class="this-page-menu"> + <li><a href="../../sources/reference/functions/highlight_html.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="html_untag.html" title="8.11.8. html_untag" + >次へ</a> |</li> + <li class="right" > + <a href="highlight_full.html" title="8.11.6. highlight_full" + >前へ</a> |</li> + <li><a href="../../index.html">Groonga v4.0.4ドキュメント</a> »</li> + <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> + <li><a href="../function.html" >8.11. 関数</a> »</li> + </ul> + </div> + <div class="footer"> + © Copyright 2009-2014, 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/functions/highlight_full.txt (+132 -0) 100644 =================================================================== --- /dev/null +++ ja/docs/sources/reference/functions/highlight_full.txt 2014-08-25 12:22:59 +0900 (0b919a2) @@ -0,0 +1,132 @@ +.. -*- rst -*- + +.. highlightlang:: none + +.. groonga-command +.. database: functions_highlight_full + +highlight_full +============== + +.. caution:: + + This feature is experimental. API will be changed. + +Summary +------- + +``highlight_full`` tags target text. It can use to highlight the search +keyword. It can specify use/not use HTML escape, the normalizer name and +change the tag for each keyword. + +Syntax +------ + +``highlight_full`` has required parameter and optional parameter:: + + highlight_full(column, normalizer_name, use_html_escape, + keyword1, open_tag1, close_tag1, + ... + [keywordN, open_tagN, close_tagN]) + +Usage +----- + +Here are a schema definition and sample data to show usage. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_full/usage_setup.log +.. table_create Entries TABLE_NO_KEY +.. column_create Entries body COLUMN_SCALAR ShortText +.. table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +.. column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body +.. load --table Entries +.. [ +.. ["content"], +.. {"body": "Mroonga is a MySQL storage engine based on Groonga. <b>Rroonga</b> is a Ruby binding of Groonga."} +.. ] + +``highlight_full`` can be used in only ``--output_columns`` in +:doc:`/reference/commands/select`. + +``highlight_full`` requires Groonga 4.0.5 or later. + +``highlight_full`` requires :doc:`/reference/command/command_version` 2 +or later. + +The following example uses HTML escape and normalzier is ``NormalizeAuto``. +It specifies the tags ``<span class="keyword1">`` and ``</span>`` of the +keyword ``groonga``, and the tags ``<span class="keyword2">`` and ``</span>`` +of the keyword ``mysql``. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_full/usage_basic.log +.. select Entries --output_columns 'highlight_full(body, "NormalizerAuto", true, "Groonga", "<span class=\\"keyword1\\">", "</span>", "mysql", "<span class=\\"keyword2\\">", "</span>")' --command_version 2 + +The text are scanned by the keywords for tagging after they are normalized +by ``NormalizerAuto`` normalizer. + +``--query "groonga mysql"`` matches to the first record's body. +``highight_full`` surrounds the keywords ``groonga`` contained in the text +with ``<span class="keyword1">`` and ``</span>``, and the keywords ``mysql`` +contained in the text with with ``<span class="keyword2">`` and ``</span>``. + +Special characters such as ``<`` and ``>`` are escapsed as ``<`` and +``>``. + +You can specify string literal instead of column. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_full/usage_string_literal.log +.. select Entries --output_columns 'highlight_full("Groonga is very fast fulltext search engine.", "NormalizerAuto", true, "Groonga", "<span class=\\"keyword1\\">", "</span>", "mysql", "<span class=\\"keyword2\\">", "</span>")' --command_version 2 --match_columns body --query "groonga" + +Parameters +---------- +There are three required parameters, ``column``, ``normalizer_name`` and ``use_html_escape``. +There are three or over optional parameters, ``keywordN``, ``open_tagN`` and ``end_tagN``. + +``column`` +^^^^^^^^^^ + +It specifies a column of the table. + +``normalizer_name`` +^^^^^^^^^^^^^^^^^^^ + +It specifies a normalizer name. + +``use_html_escape`` +^^^^^^^^^^^^^^^^^^^ + +It specifies use or not use HTML escape. If it is ``true`` , use HTML escape. +If it is ``false`` , not use HTML escape. + +``keywordN`` +^^^^^^^^^^^^ + +It specifies a keyword for tagging. +You can specify multiple keywords for each three arguments. + +``open_tagN`` +^^^^^^^^^^^^^ + +It specifies a open tag. +You can specify multiple open tags for each three arguments. + +``close_tagN`` +^^^^^^^^^^^^^^ + +It specifies a close tag. +You can specify multiple close tags for each three arguments. + +Return value +------------ + +``highlight_full`` returns a tagged string or ``null``. If +``highlight_full`` can't find any keywords, it returns ``null``. + +See also +-------- + +* :doc:`/reference/commands/select` +* :doc:`/reference/functions/highlight_html` Added: ja/docs/sources/reference/functions/highlight_html.txt (+100 -0) 100644 =================================================================== --- /dev/null +++ ja/docs/sources/reference/functions/highlight_html.txt 2014-08-25 12:22:59 +0900 (533a5bf) @@ -0,0 +1,100 @@ +.. -*- rst -*- + +.. highlightlang:: none + +.. groonga-command +.. database: functions_highlight_html + +highlight_html +============== + +.. caution:: + + This feature is experimental. API will be changed. + +Summary +------- + +``highlight_html`` tags target text. It can use to highlight the search +keywords. The tagged text are prepared for embedding HTML. Special +characters such as ``<`` and ``>`` are escapsed as ``<`` and ``>``. +Keyword is surrounded with ``<span class="keyword">`` and ``</span>``. +For example, a tagged text of ``I am a groonga user. <3`` for keyword +``groonga`` is ``I am a <span class="keyword">groonga</span> user. <3``. + +Syntax +------ + +``highlight_html`` has only one parameter:: + + highlight_html(column) + +Usage +----- + +Here are a schema definition and sample data to show usage. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_html/usage_setup.log +.. table_create Entries TABLE_NO_KEY +.. column_create Entries body COLUMN_SCALAR ShortText +.. table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +.. column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body +.. load --table Entries +.. [ +.. ["content"], +.. {"body": "Mroonga is a MySQL storage engine based on Groonga. <b>Rroonga</b> is a Ruby binding of Groonga."} +.. ] + +``highlight_html`` can be used in only ``--output_columns`` in +:doc:`/reference/commands/select`. + +``highlight_html`` requires Groonga 4.0.5 or later. + +``highlight_html`` requires :doc:`/reference/command/command_version` 2 +or later. + +You also need to specify ``--query`` and/or ``--filter``. Keywords are +extracted from ``--query`` and ``--filter`` arguments. + +The following example uses ``--query "groonga mysql"``. In this case, +``groonga`` and ``mysql`` are used as keywords. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_html/usage_basic.log +.. select Entries --output_columns --match_columns body --query 'groonga mysql' --output_columns 'highlight_html(body)' --command_version 2 + +The text are scanned by the keywords for tagging after they are normalized +by ``NormalizerAuto`` normalizer. + +``--query "groonga mysql"`` matches to only the first record's body. +``highlight_html(body)`` surrounds the keywords ``groonga`` or ``mysql`` +contained in the text with ``<span class="keyword">`` and ``</span>``. + +You can specify string literal instead of column. + +.. groonga-command +.. include:: ../../example/reference/functions/highlight_html/usage_string_literal.log +.. select Entries --output_columns 'highlight_html("Groonga is very fast fulltext search engine.")' --command_version 2 --match_columns body --query "groonga" + +Parameters +---------- + +There is only one parameter ``column`` . + +``column`` +^^^^^^^^^^ + +It specifies a column of the table. + +Return value +------------ + +``highlight_html`` returns a tagged string or ``null``. If +``highlight_html`` can't find any keywords, it returns ``null``. + +See also +-------- + +* :doc:`/reference/commands/select` +* :doc:`/reference/functions/highlight_full` -------------- next part -------------- HTML����������������������������...Descargar