<!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.4. データ型 — 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.5. テーブル" href="tables.html" /> <link rel="prev" title="8.3.30. truncate" href="commands/truncate.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/types.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="tables.html" title="8.5. テーブル" accesskey="N">次へ</a> |</li> <li class="right" > <a href="commands/truncate.html" title="8.3.30. truncate" accesskey="P">前へ</a> |</li> <li><a href="../index.html">groonga v3.0.5ドキュメント</a> »</li> <li><a href="../reference.html" accesskey="U">8. リファレンスマニュアル</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="id1"> <h1>8.4. データ型<a class="headerlink" href="#id1" title="このヘッドラインへのパーマリンク">¶</a></h1> <div class="section" id="id2"> <h2>8.4.1. 名前<a class="headerlink" href="#id2" title="このヘッドラインへのパーマリンク">¶</a></h2> <p>groonga データ型</p> </div> <div class="section" id="id3"> <h2>8.4.2. 説明<a class="headerlink" href="#id3" title="このヘッドラインへのパーマリンク">¶</a></h2> <p>groonga は、格納するデータの型を区別します。</p> <p>groongaのデータベースでは、テーブルの主キーや、カラムの値はいずれも何らかの型に属します。また通常は、一つのテーブルの中の全てのレコードについて、カラムの値は共通となります。</p> <p>主キーの型とカラムの型には、groongaで予め定義済みの型か、ユーザが定義する型、またはユーザが定義したテーブルを指定することができます。</p> <p>主キーの型に他のテーブルを指定する場合は、そのテーブルは、主キーの型となるテーブルのサブセットとなります。</p> <p>カラムの型に他のテーブルを指定する場合は、そのカラムは、カラムの型となるテーブルの参照キーとなります。</p> </div> <div class="section" id="id4"> <h2>8.4.3. 組込型<a class="headerlink" href="#id4" title="このヘッドラインへのパーマリンク">¶</a></h2> <p>以下の型が組込型としてあらかじめ定義されています。</p> <p><tt class="docutils literal"><span class="pre">Object</span></tt></p> <blockquote> <div>任意のテーブルに属する全てのレコードです。 <a class="footnote-reference" href="#id9" id="id5">[1]</a></div></blockquote> <p><tt class="docutils literal"><span class="pre">Bool</span></tt></p> <blockquote> <div><p>ブーリアン型やブール型などと呼ばれる型であり、真偽値を表します。取り得る値はtrueとfalseです。(デフォルト値: false)</p> <p><a class="reference internal" href="commands/load.html"><em>load</em></a> コマンドで値を格納するときは、false、0、空文字列のいずれかを指定するとfalseになり、それ以外を指定するとtrueになります。</p> </div></blockquote> <p><tt class="docutils literal"><span class="pre">Int8</span></tt></p> <blockquote> <div>8bit符号付き整数であり、-128以上127以下の整数を表します。(デフォルト値: 0)</div></blockquote> <p><tt class="docutils literal"><span class="pre">UInt8</span></tt></p> <blockquote> <div>8bit符号なし整数であり、0以上255以下の整数を表します。(デフォルト値: 0)</div></blockquote> <p><tt class="docutils literal"><span class="pre">Int16</span></tt></p> <blockquote> <div>16bit符号付き整数であり、-32,768以上32,767以下の整数を表します。(デフォルト値: 0)</div></blockquote> <p><tt class="docutils literal"><span class="pre">UInt16</span></tt></p> <blockquote> <div>16bit符号なし整数であり、0以上65,535以下の整数を表します。(デフォルト値: 0)</div></blockquote> <p><tt class="docutils literal"><span class="pre">Int32</span></tt></p> <blockquote> <div>32bit符号付き整数であり、-2,147,483,648以上2,147,483,647以下の整数を表します。(デフォルト値: 0)</div></blockquote> <p><tt class="docutils literal"><span class="pre">UInt32</span></tt></p> <blockquote> <div>32bit符号なし整数であり、0以上4,294,967,295以下の整数を表します。(デフォルト値: 0)</div></blockquote> <p><tt class="docutils literal"><span class="pre">Int64</span></tt></p> <blockquote> <div>64bit符号付き整数であり、-9,223,372,036,854,775,808以上9,223,372,036,854,775,807以下の整数を表します。(デフォルト値: 0)</div></blockquote> <p><tt class="docutils literal"><span class="pre">UInt64</span></tt></p> <blockquote> <div>64bit符号なし整数であり、0以上18,446,744,073,709,551,615以下の整数を表します。(デフォルト値: 0)</div></blockquote> <p>浮動小数点数</p> <blockquote> <div><p>IEEE 754形式の倍精度浮動小数点数であり、実数を表します。(デフォルト値: 0.0)</p> <p>IEEE 754形式の詳細については、 <a class="reference external" href="http://ja.wikipedia.org/wiki/IEEE_754">IEEE 754 - Wikipedia</a> や <a class="reference external" href="http://grouper.ieee.org/groups/754/">IEEE 754: Standard for Binary Floating-Point</a> を参照してください。</p> </div></blockquote> <p>時間</p> <blockquote> <div><p>日時を表す型であり、1970年1月1日0時0分0秒からの経過時間を、マイクロ秒単位で64bit符号付き整数により表現します。(デフォルト値: 0)</p> <p><a class="reference internal" href="commands/load.html"><em>load</em></a> コマンドで値を格納するときは、1970年1月1日0時0分0秒からの経過秒数を指定します。秒単位より詳細な日時を指定するには、小数を使います。</p> </div></blockquote> <p><tt class="docutils literal"><span class="pre">ShortText</span></tt></p> <blockquote> <div>4,095バイト以下の文字列を表します。(デフォルト値: "")</div></blockquote> <p><tt class="docutils literal"><span class="pre">Text</span></tt></p> <blockquote> <div>65,535バイト以下の文字列を表します。(デフォルト値: "")</div></blockquote> <p><tt class="docutils literal"><span class="pre">LongText</span></tt></p> <blockquote> <div>2,147,483,647バイト以下の文字列を表します。(デフォルト値: "")</div></blockquote> <p><tt class="docutils literal"><span class="pre">TokyoGeoPoint</span></tt></p> <blockquote> <div><p>旧日本測地系による経緯度であり、経度と緯度をミリ秒単位で表現した整数の組により表現します。(デフォルト値: 0x0)</p> <p>度分秒形式でx度y分z秒となる経度・緯度は、(((x * 60) + y) * 60 + z) * 1000という計算式でミリ秒単位へと変換されます。 <a class="reference internal" href="commands/load.html"><em>load</em></a> コマンドで値を格納するときは、"ミリ秒単位の経度xミリ秒単位の緯度" もしくは "経度の小数表記x緯度の小数表記" という文字列表現を使って指定します。経度と緯度の区切りとしては、'x' のほかに ',' を使うことができます。</p> <p>測地系の詳細については、 <a class="reference external" href="http://ja.wikipedia.org/wiki/%E6%B8%AC%E5%9C%B0%E7%B3%BB">測地系 - Wikipedia</a> を参照してください。</p> </div></blockquote> <p><tt class="docutils literal"><span class="pre">WGS84GeoPoint</span></tt></p> <blockquote> <div><p>世界測地系(World Geodetic System, WGS 84)による経緯度であり、経度と緯度をミリ秒単位で表現した整数の組により表現します。(デフォルト値: 0x0)</p> <p>度分秒形式からミリ秒形式への変換方法や <a class="reference internal" href="commands/load.html"><em>load</em></a> コマンドにおける指定方法はTokyoGeoPointと同じです。</p> </div></blockquote> </div> <div class="section" id="id6"> <h2>8.4.4. 型に関する制限事項<a class="headerlink" href="#id6" title="このヘッドラインへのパーマリンク">¶</a></h2> <div class="section" id="id7"> <h3>8.4.4.1. テーブルの主キーに指定できない型<a class="headerlink" href="#id7" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>Text型とLongText型については、テーブルの主キーに指定することはできません。</p> </div> <div class="section" id="id8"> <h3>8.4.4.2. ベクターとして格納できない型<a class="headerlink" href="#id8" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>groongaのカラムは、ある型のベクターを保存することができます。しかし、ShortText, Text, LongTextの3つの型についてはベクターとして保存したり出力したりすることはできますが、検索条件やドリルダウン条件に指定することができません。</p> <p>テーブル型は、ベクターとして格納することができます。よって、ShortTextのベクターを検索条件やドリルダウン条件に使用したい場合には、主キーがShortText型のテーブルを別途作成し、そのテーブルを型として利用します。</p> <p class="rubric">脚注</p> <table class="docutils footnote" frame="void" id="id9" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a class="fn-backref" href="#id5">[1]</a></td><td>Object型はv1.2でサポートされます。</td></tr> </tbody> </table> </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.4. データ型</a><ul> <li><a class="reference internal" href="#id2">8.4.1. 名前</a></li> <li><a class="reference internal" href="#id3">8.4.2. 説明</a></li> <li><a class="reference internal" href="#id4">8.4.3. 組込型</a></li> <li><a class="reference internal" href="#id6">8.4.4. 型に関する制限事項</a><ul> <li><a class="reference internal" href="#id7">8.4.4.1. テーブルの主キーに指定できない型</a></li> <li><a class="reference internal" href="#id8">8.4.4.2. ベクターとして格納できない型</a></li> </ul> </li> </ul> </li> </ul> <h4>前のトピックへ</h4> <p class="topless"><a href="commands/truncate.html" title="前の章へ">8.3.30. <tt class="docutils literal docutils literal docutils literal docutils literal"><span class="pre">truncate</span></tt></a></p> <h4>次のトピックへ</h4> <p class="topless"><a href="tables.html" title="次の章へ">8.5. テーブル</a></p> <h3>このページ</h3> <ul class="this-page-menu"> <li><a href="../_sources/reference/types.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="tables.html" title="8.5. テーブル" >次へ</a> |</li> <li class="right" > <a href="commands/truncate.html" title="8.3.30. truncate" >前へ</a> |</li> <li><a href="../index.html">groonga v3.0.5ドキュメント</a> »</li> <li><a href="../reference.html" >8. リファレンスマニュアル</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009-2013, Brazil, Inc. </div> </body> </html>