Sophie

Sophie

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

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. 出力 &mdash; groonga v3.0.5ドキュメント</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>
    <script type="text/javascript" src="../_static/translations.js"></script>
    <link rel="shortcut icon" href="../_static/favicon.ico"/>
    <link rel="top" title="groonga v3.0.5ドキュメント" href="../index.html" />
    <link rel="up" title="8. リファレンスマニュアル" href="../reference.html" />
    <link rel="next" title="8.3. コマンド" 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">オープンソースのカラムストア機能付き全文検索エンジン</span>
    </a>
  </h1>

  <div class="other-language-links">
    <ul>
      <li><a href="../../../en/html/reference/output.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="command.html" title="8.3. コマンド"
             accesskey="N">次へ</a> |</li>
        <li class="right" >
          <a href="executables/groonga-suggest-create-dataset.html" title="8.1.6. groonga-suggest-create-dataset"
             accesskey="P">前へ</a> |</li>
        <li><a href="../index.html">groonga v3.0.5ドキュメント</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. 出力<a class="headerlink" href="#output" title="このヘッドラインへのパーマリンク">¶</a></h1>
<p>groongaは以下の出力形式をサポートしています。</p>
<blockquote>
<div><ul class="simple">
<li><p class="first"><a class="reference external" href="http://www.json.org/json-ja.html">JSON</a></p>
</li>
<li><a class="reference external" href="http://www.w3.org/XML/">XML</a></li>
<li><p class="first">TSV(タブ区切り形式)</p>
</li>
<li><a class="reference external" href="http://msgpack.org/">MessagePack</a></li>
</ul>
</div></blockquote>
<p>JSONがデフォルトの出力形式です。</p>
<div class="section" id="usage">
<h2>8.2.1. 使い方<a class="headerlink" href="#usage" title="このヘッドラインへのパーマリンク">¶</a></h2>
<p>groongaには以下のクエリーインターフェイスがあります。</p>
<blockquote>
<div><ul class="simple">
<li><p class="first">コマンドライン</p>
</li>
<li>HTTP</li>
</ul>
</div></blockquote>
<p>それぞれのインターフェイスで出力形式を変更する方法は異なります。</p>
<div class="section" id="command-line">
<h3>8.2.1.1. コマンドライン<a class="headerlink" href="#command-line" title="このヘッドラインへのパーマリンク">¶</a></h3>
<p><tt class="docutils literal"><span class="pre">groonga</span> <span class="pre">DB_PATH</span></tt> または <tt class="docutils literal"><span class="pre">groonga</span> <span class="pre">-c</span></tt> でコマンドラインクエリーインターフェイスを使うことができます。これらのgroongaコマンドでは <tt class="docutils literal"><span class="pre">&gt;</span> <span class="pre">``</span> <span class="pre">というプロンプトが表示されます。クエリーインターフェイスでは</span> <span class="pre">``output_type</span></tt> オプションで出力形式を指定できます。</p>
<p><tt class="docutils literal"><span class="pre">output_type</span></tt> オプションを指定しない場合はJSON形式の出力になります:</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>明示的に <tt class="docutils literal"><span class="pre">output_type</span></tt> に <tt class="docutils literal"><span class="pre">json</span></tt> を指定することもできます。この場合はJSON形式の出力になります:</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>XML形式の出力にする場合は <tt class="docutils literal"><span class="pre">output_type</span></tt> に <tt class="docutils literal"><span class="pre">xml</span></tt> を指定します:</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>TSV形式の出力にする場合は <tt class="docutils literal"><span class="pre">output_type</span></tt> に <tt class="docutils literal"><span class="pre">tsv</span></tt> を指定します::&lt;</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>MessagePack形式の出力にする場合は <tt class="docutils literal"><span class="pre">output_type</span></tt> に <tt class="docutils literal"><span class="pre">msgpack</span></tt> を指定します::&lt;</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="このヘッドラインへのパーマリンク">¶</a></h3>
<p><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> でHTTPクエリーインターフェイスを使うことができます。groonga HTTPサーバーはデフォルトで10041番ポートで起動します。このクエリーインターフェイスでは拡張子で出力形式を指定します。</p>
<p>拡張子を指定しない場合はJSON形式の出力になります:</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>明示的に <tt class="docutils literal"><span class="pre">json</span></tt> 拡張子を指定することもできます。この場合はJSON形式の出力になります:</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>XML形式の出力にする場合は <tt class="docutils literal"><span class="pre">xml</span></tt> 拡張子を指定します:</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>TSV形式の出力にする場合は <tt class="docutils literal"><span class="pre">tsv</span></tt> 拡張子を指定します:</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>MessagePack形式の出力にする場合は <tt class="docutils literal"><span class="pre">msgpack</span></tt> 拡張子を指定します:</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">目次</a></h3>
  <ul>
<li><a class="reference internal" href="#">8.2. 出力</a><ul>
<li><a class="reference internal" href="#usage">8.2.1. 使い方</a><ul>
<li><a class="reference internal" href="#command-line">8.2.1.1. コマンドライン</a></li>
<li><a class="reference internal" href="#http">8.2.1.2. HTTP</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>前のトピックへ</h4>
  <p class="topless"><a href="executables/groonga-suggest-create-dataset.html"
                        title="前の章へ">8.1.6. groonga-suggest-create-dataset</a></p>
  <h4>次のトピックへ</h4>
  <p class="topless"><a href="command.html"
                        title="次の章へ">8.3. コマンド</a></p>
  <h3>このページ</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/reference/output.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="command.html" title="8.3. コマンド"
             >次へ</a> |</li>
        <li class="right" >
          <a href="executables/groonga-suggest-create-dataset.html" title="8.1.6. groonga-suggest-create-dataset"
             >前へ</a> |</li>
        <li><a href="../index.html">groonga v3.0.5ドキュメント</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>