Sophie

Sophie

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

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


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


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

  <div class="other-language-links">
    <ul>
      <li><a href="../../../ja/html/reference/output.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="command.html" title="8.3. Command"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="executables/groonga-suggest-create-dataset.html" title="8.1.6. groonga-suggest-create-dataset"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">groonga v3.0.5 documentation</a> &raquo;</li>
          <li><a href="../reference.html" accesskey="U">8. リファレンスマニュアル</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="output">
<h1>8.2. Output<a class="headerlink" href="#output" title="Permalink to this headline">¶</a></h1>
<p>Groonga supports the following output format types:</p>
<blockquote>
<div><ul class="simple">
<li><a class="reference external" href="http://www.json.org/">JSON</a></li>
<li><a class="reference external" href="http://www.w3.org/XML/">XML</a></li>
<li>TSV (Tab Separated Values)</li>
<li><a class="reference external" href="http://msgpack.org/">MessagePack</a></li>
</ul>
</div></blockquote>
<p>JSON is the default output format.</p>
<div class="section" id="usage">
<h2>8.2.1. Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2>
<p>Groonga has the following query interfaces:</p>
<blockquote>
<div><ul class="simple">
<li>command line</li>
<li>HTTP</li>
</ul>
</div></blockquote>
<p>They provides different ways to change output format type.</p>
<div class="section" id="command-line">
<h3>8.2.1.1. Command line<a class="headerlink" href="#command-line" title="Permalink to this headline">¶</a></h3>
<p>You can use command line query interface by <tt class="docutils literal"><span class="pre">groonga</span>
<span class="pre">DB_PATH</span></tt> or <tt class="docutils literal"><span class="pre">groonga</span> <span class="pre">-c</span></tt>. Those groonga commands shows
<tt class="docutils literal"><span class="pre">&gt;</span> <span class="pre">``</span> <span class="pre">prompt.</span> <span class="pre">In</span> <span class="pre">this</span> <span class="pre">query</span> <span class="pre">interface,</span> <span class="pre">you</span> <span class="pre">can</span> <span class="pre">specify</span>
<span class="pre">output</span> <span class="pre">format</span> <span class="pre">type</span> <span class="pre">by</span> <span class="pre">``output_type</span></tt> option.</p>
<p>If you don't specify <tt class="docutils literal"><span class="pre">output_type</span></tt> option, you will get
a result in JSON format:</p>
<div class="highlight-none"><div class="highlight"><pre>&gt; status
[[0,1327721628.10738,0.000131845474243164],{&quot;alloc_count&quot;:142,&quot;starttime&quot;:1327721626,&quot;uptime&quot;:2,&quot;version&quot;:&quot;1.2.9-92-gb87d9f8&quot;,&quot;n_queries&quot;:0,&quot;cache_hit_rate&quot;:0.0,&quot;command_version&quot;:1,&quot;default_command_version&quot;:1,&quot;max_command_version&quot;:2}]
</pre></div>
</div>
<p>You can specify <tt class="docutils literal"><span class="pre">json</span></tt> as <tt class="docutils literal"><span class="pre">output_type</span></tt> value to get a
result in JSON format explicitly:</p>
<div class="highlight-none"><div class="highlight"><pre>&gt; status --output_type json
[[0,1327721639.08321,7.93933868408203e-05],{&quot;alloc_count&quot;:144,&quot;starttime&quot;:1327721626,&quot;uptime&quot;:13,&quot;version&quot;:&quot;1.2.9-92-gb87d9f8&quot;,&quot;n_queries&quot;:0,&quot;cache_hit_rate&quot;:0.0,&quot;command_version&quot;:1,&quot;default_command_version&quot;:1,&quot;max_command_version&quot;:2}]
</pre></div>
</div>
<p>You need to specify <tt class="docutils literal"><span class="pre">xml</span></tt> as <tt class="docutils literal"><span class="pre">output_type</span></tt> value to
get a result in XML format:</p>
<div class="highlight-none"><div class="highlight"><pre>&gt; status --output_type xml
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;RESULT CODE=&quot;0&quot; UP=&quot;1327721649.61095&quot; ELAPSED=&quot;0.000126361846923828&quot;&gt;
&lt;RESULT&gt;
&lt;TEXT&gt;alloc_count&lt;/TEXT&gt;
&lt;INT&gt;146&lt;/INT&gt;
&lt;TEXT&gt;starttime&lt;/TEXT&gt;
&lt;INT&gt;1327721626&lt;/INT&gt;
&lt;TEXT&gt;uptime&lt;/TEXT&gt;
&lt;INT&gt;23&lt;/INT&gt;
&lt;TEXT&gt;version&lt;/TEXT&gt;
&lt;TEXT&gt;1.2.9-92-gb87d9f8&lt;/TEXT&gt;
&lt;TEXT&gt;n_queries&lt;/TEXT&gt;
&lt;INT&gt;0&lt;/INT&gt;
&lt;TEXT&gt;cache_hit_rate&lt;/TEXT&gt;
&lt;FLOAT&gt;0.0&lt;/FLOAT&gt;
&lt;TEXT&gt;command_version&lt;/TEXT&gt;
&lt;INT&gt;1&lt;/INT&gt;
&lt;TEXT&gt;default_command_version&lt;/TEXT&gt;
&lt;INT&gt;1&lt;/INT&gt;
&lt;TEXT&gt;max_command_version&lt;/TEXT&gt;
&lt;INT&gt;2&lt;/INT&gt;&lt;/RESULT&gt;
&lt;/RESULT&gt;
</pre></div>
</div>
<p>You need to specify <tt class="docutils literal"><span class="pre">tsv</span></tt> as <tt class="docutils literal"><span class="pre">output_type</span></tt> value to
get a result in TSV format:</p>
<div class="highlight-none"><div class="highlight"><pre>&gt; status --output_type tsv
0     1327721664.82675        0.000113964080810547
&quot;alloc_count&quot; 146
&quot;starttime&quot;   1327721626
&quot;uptime&quot;      38
&quot;version&quot;     &quot;1.2.9-92-gb87d9f8&quot;
&quot;n_queries&quot;   0
&quot;cache_hit_rate&quot;      0.0
&quot;command_version&quot;     1
&quot;default_command_version&quot;     1
&quot;max_command_version&quot; 2
END
</pre></div>
</div>
<p>You need to specify <tt class="docutils literal"><span class="pre">msgpack</span></tt> as <tt class="docutils literal"><span class="pre">output_type</span></tt> value to
get a result in MessagePack format:</p>
<div class="highlight-none"><div class="highlight"><pre>&gt; status --output_type msgpack
(... omitted because MessagePack is binary data format. ...)
</pre></div>
</div>
</div>
<div class="section" id="http">
<h3>8.2.1.2. HTTP<a class="headerlink" href="#http" title="Permalink to this headline">¶</a></h3>
<p>You can use HTTP query interface by <tt class="docutils literal"><span class="pre">groonga</span> <span class="pre">--protocol</span>
<span class="pre">http</span> <span class="pre">-s</span> <span class="pre">DB_PATH</span></tt>. Groonga HTTP server starts on port 10041
by default. In this query interface, you can specify
output format type by extension.</p>
<p>If you don't specify extension, you will get a result in
JSON format:</p>
<div class="highlight-none"><div class="highlight"><pre>% curl http://localhost:10041/d/status
[[0,1327809294.54311,0.00082087516784668],{&quot;alloc_count&quot;:155,&quot;starttime&quot;:1327809282,&quot;uptime&quot;:12,&quot;version&quot;:&quot;1.2.9-92-gb87d9f8&quot;,&quot;n_queries&quot;:0,&quot;cache_hit_rate&quot;:0.0,&quot;command_version&quot;:1,&quot;default_command_version&quot;:1,&quot;max_command_version&quot;:2}]
</pre></div>
</div>
<p>You can specify <tt class="docutils literal"><span class="pre">json</span></tt> as extension to get a result in
JSON format explicitly:</p>
<div class="highlight-none"><div class="highlight"><pre>% curl http://localhost:10041/d/status.json
[[0,1327809319.01929,9.5367431640625e-05],{&quot;alloc_count&quot;:157,&quot;starttime&quot;:1327809282,&quot;uptime&quot;:37,&quot;version&quot;:&quot;1.2.9-92-gb87d9f8&quot;,&quot;n_queries&quot;:0,&quot;cache_hit_rate&quot;:0.0,&quot;command_version&quot;:1,&quot;default_command_version&quot;:1,&quot;max_command_version&quot;:2}]
</pre></div>
</div>
<p>You need to specify <tt class="docutils literal"><span class="pre">xml</span></tt> as extension to get a result in
XML format:</p>
<div class="highlight-none"><div class="highlight"><pre>% curl http://localhost:10041/d/status.xml
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;RESULT CODE=&quot;0&quot; UP=&quot;1327809339.5782&quot; ELAPSED=&quot;9.56058502197266e-05&quot;&gt;
&lt;RESULT&gt;
&lt;TEXT&gt;alloc_count&lt;/TEXT&gt;
&lt;INT&gt;159&lt;/INT&gt;
&lt;TEXT&gt;starttime&lt;/TEXT&gt;
&lt;INT&gt;1327809282&lt;/INT&gt;
&lt;TEXT&gt;uptime&lt;/TEXT&gt;
&lt;INT&gt;57&lt;/INT&gt;
&lt;TEXT&gt;version&lt;/TEXT&gt;
&lt;TEXT&gt;1.2.9-92-gb87d9f8&lt;/TEXT&gt;
&lt;TEXT&gt;n_queries&lt;/TEXT&gt;
&lt;INT&gt;0&lt;/INT&gt;
&lt;TEXT&gt;cache_hit_rate&lt;/TEXT&gt;
&lt;FLOAT&gt;0.0&lt;/FLOAT&gt;
&lt;TEXT&gt;command_version&lt;/TEXT&gt;
&lt;INT&gt;1&lt;/INT&gt;
&lt;TEXT&gt;default_command_version&lt;/TEXT&gt;
&lt;INT&gt;1&lt;/INT&gt;
&lt;TEXT&gt;max_command_version&lt;/TEXT&gt;
&lt;INT&gt;2&lt;/INT&gt;&lt;/RESULT&gt;
&lt;/RESULT&gt;
</pre></div>
</div>
<p>You need to specify <tt class="docutils literal"><span class="pre">tsv</span></tt> as extension to get a result in
TSV format:</p>
<div class="highlight-none"><div class="highlight"><pre>% curl http://localhost:10041/d/status.tsv
0     1327809366.84187        8.44001770019531e-05
&quot;alloc_count&quot; 159
&quot;starttime&quot;   1327809282
&quot;uptime&quot;      84
&quot;version&quot;     &quot;1.2.9-92-gb87d9f8&quot;
&quot;n_queries&quot;   0
&quot;cache_hit_rate&quot;      0.0
&quot;command_version&quot;     1
&quot;default_command_version&quot;     1
&quot;max_command_version&quot; 2
END
</pre></div>
</div>
<p>You need to specify <tt class="docutils literal"><span class="pre">msgpack</span></tt> as extension to get a result
in MessagePack format:</p>
<div class="highlight-none"><div class="highlight"><pre>% curl http://localhost:10041/d/status.msgpack
(... omitted because MessagePack is binary data format. ...)
</pre></div>
</div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">8.2. Output</a><ul>
<li><a class="reference internal" href="#usage">8.2.1. Usage</a><ul>
<li><a class="reference internal" href="#command-line">8.2.1.1. Command line</a></li>
<li><a class="reference internal" href="#http">8.2.1.2. HTTP</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="executables/groonga-suggest-create-dataset.html"
                        title="previous chapter">8.1.6. groonga-suggest-create-dataset</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="command.html"
                        title="next chapter">8.3. Command</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/reference/output.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="command.html" title="8.3. Command"
             >next</a> |</li>
        <li class="right" >
          <a href="executables/groonga-suggest-create-dataset.html" title="8.1.6. groonga-suggest-create-dataset"
             >previous</a> |</li>
        <li><a href="../index.html">groonga v3.0.5 documentation</a> &raquo;</li>
          <li><a href="../reference.html" >8. リファレンスマニュアル</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2009-2013, Brazil, Inc.
    </div>
  </body>
</html>