<!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.10.2. スクリプト構文 — 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.10. grn_expr" href="../grn_expr.html" /> <link rel="next" title="8.11. 関数" href="../function.html" /> <link rel="prev" title="8.10.1. クエリー構文" href="query_syntax.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/grn_expr/script_syntax.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="../function.html" title="8.11. 関数" accesskey="N">次へ</a> |</li> <li class="right" > <a href="query_syntax.html" title="8.10.1. クエリー構文" accesskey="P">前へ</a> |</li> <li><a href="../../index.html">groonga v3.0.5ドキュメント</a> »</li> <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> <li><a href="../grn_expr.html" accesskey="U">8.10. grn_expr</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="script-syntax"> <h1>8.10.2. スクリプト構文<a class="headerlink" href="#script-syntax" title="このヘッドラインへのパーマリンク">¶</a></h1> <p>スクリプト構文は複雑な検索条件を指定するための構文です。この構文はECMAScriptに似ています。例えば、 <tt class="docutils literal"><span class="pre">_key</span> <span class="pre">==</span> <span class="pre">"book"</span></tt> は <tt class="docutils literal"><span class="pre">_key</span></tt> の値が <tt class="docutils literal"><span class="pre">"book"</span></tt> のレコードを検索するという意味です。 <a class="reference internal" href="query_syntax.html"><em>クエリー構文</em></a> ではすべての値は文字列でしたが、スクリプト構文では値に型があります。例えば、 <tt class="docutils literal"><span class="pre">"book"</span></tt> は文字列で <tt class="docutils literal"><span class="pre">1</span></tt> は整数で、 <tt class="docutils literal"><span class="pre">TokenBigram</span></tt> は <tt class="docutils literal"><span class="pre">TokenBigram</span></tt> という名前のオブジェクトです。</p> <p>スクリプト構文はECMAScriptの構文と完全に互換性があるわけではありません。例えば、 <tt class="docutils literal"><span class="pre">if</span></tt> 制御文や <tt class="docutils literal"><span class="pre">for</span></tt> 繰り返し文や変数定義文といった文をサポートしていません。関数定義もサポートしていません。しかし、独自の演算子を追加しています。独自の演算子はECMAScriptの構文を説明した後に説明します。</p> <div class="section" id="sample-data"> <h2>8.10.2.1. サンプルデータ<a class="headerlink" href="#sample-data" title="このヘッドラインへのパーマリンク">¶</a></h2> <p>使い方を示すために使うスキーマ定義とサンプルデータは以下の通りです。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>table_create Entries TABLE_PAT_KEY ShortText # [[0, 1337566253.89858, 0.000355720520019531], true] column_create Entries content COLUMN_SCALAR Text # [[0, 1337566253.89858, 0.000355720520019531], true] column_create Entries n_likes COLUMN_SCALAR UInt32 # [[0, 1337566253.89858, 0.000355720520019531], true] table_create Terms TABLE_PAT_KEY|KEY_NORMALIZE ShortText --default_tokenizer TokenBigram # [[0, 1337566253.89858, 0.000355720520019531], true] column_create Terms entries_key_index COLUMN_INDEX|WITH_POSITION Entries _key # [[0, 1337566253.89858, 0.000355720520019531], true] column_create Terms entries_content_index COLUMN_INDEX|WITH_POSITION Entries content # [[0, 1337566253.89858, 0.000355720520019531], true] load --table Entries [ {"_key": "The first post!", "content": "Welcome! This is my first post!", "n_likes": 5}, {"_key": "Groonga", "content": "I started to use groonga. It's very fast!", "n_likes": 10}, {"_key": "Mroonga", "content": "I also started to use mroonga. It's also very fast! Really fast!", "n_likes": 15}, {"_key": "Good-bye Senna", "content": "I migrated all Senna system!", "n_likes": 3}, {"_key": "Good-bye Tritonn", "content": "I also migrated all Tritonn system!", "n_likes": 3} ] # [[0, 1337566253.89858, 0.000355720520019531], 5] </pre></div> </div> <p>ブログエントリ用の <tt class="docutils literal"><span class="pre">Entries</span></tt> テーブルがあります。各エントリはタイトルと内容と「いいね!」数を持っています。タイトルは <tt class="docutils literal"><span class="pre">Entries</span></tt> のキーとします。内容は <tt class="docutils literal"><span class="pre">Entries.content</span></tt> カラムの値とします。「いいね!」数は <tt class="docutils literal"><span class="pre">Entries.n_likes</span></tt> カラムの値とします。</p> <p><tt class="docutils literal"><span class="pre">Entries._key</span></tt> カラムと <tt class="docutils literal"><span class="pre">Entries.content</span></tt> カラムには <tt class="docutils literal"><span class="pre">TokenBigram</span></tt> トークナイザーを使ったインデックスを作成します。そのため、 <tt class="docutils literal"><span class="pre">Entries._key</span></tt> と <tt class="docutils literal"><span class="pre">Entries.content</span></tt> は両方とも全文検索できます。</p> <p>これで例を示すためのスキーマとデータの準備ができました。</p> </div> <div class="section" id="literals"> <h2>8.10.2.2. リテラル<a class="headerlink" href="#literals" title="このヘッドラインへのパーマリンク">¶</a></h2> <div class="section" id="integer"> <h3>8.10.2.2.1. 整数<a class="headerlink" href="#integer" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>整数リテラルは <tt class="docutils literal"><span class="pre">1234567890</span></tt> のような <tt class="docutils literal"><span class="pre">0</span></tt> から <tt class="docutils literal"><span class="pre">9</span></tt> の並びです。 <tt class="docutils literal"><span class="pre">+29</span></tt> や <tt class="docutils literal"><span class="pre">-29</span></tt> のように符号として最初に <tt class="docutils literal"><span class="pre">+</span></tt> または <tt class="docutils literal"><span class="pre">-</span></tt> をつけることができます。整数リテラルは10進数です。8進数や16進数などは使えません。</p> <p>整数リテラルの最大値は <tt class="docutils literal"><span class="pre">9223372036854775807</span></tt> ( <tt class="docutils literal"><span class="pre">=</span> <span class="pre">2</span> <span class="pre">**</span> <span class="pre">63</span> <span class="pre">-</span> <span class="pre">1</span></tt> )です。最小値は <tt class="docutils literal"><span class="pre">-9223372036854775808</span></tt> ( <tt class="docutils literal"><span class="pre">=</span> <span class="pre">-(2</span> <span class="pre">**</span> <span class="pre">63)</span></tt> )です。</p> </div> <div class="section" id="float"> <h3>8.10.2.2.2. 浮動小数点数<a class="headerlink" href="#float" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>浮動小数点数リテラルは <tt class="docutils literal"><span class="pre">3.14</span></tt> のように、まず <tt class="docutils literal"><span class="pre">0</span></tt> から <tt class="docutils literal"><span class="pre">9</span></tt> 、次に <tt class="docutils literal"><span class="pre">.</span></tt> 、最後に <tt class="docutils literal"><span class="pre">0</span></tt> から <tt class="docutils literal"><span class="pre">9</span></tt> という並びです。 <tt class="docutils literal"><span class="pre">+3.14</span></tt> や <tt class="docutils literal"><span class="pre">-3.14</span></tt> のように符号として最初に <tt class="docutils literal"><span class="pre">+</span></tt> または <tt class="docutils literal"><span class="pre">-</span></tt> をつけることができます。 <tt class="docutils literal"><span class="pre">${基数}e${指数}</span></tt> や <tt class="docutils literal"><span class="pre">${基数}E${指数}</span></tt> というフォーマットもサポートしています。例えば、 <tt class="docutils literal"><span class="pre">314e-2</span></tt> は <tt class="docutils literal"><span class="pre">3.14</span></tt> と同じです。</p> </div> <div class="section" id="string"> <h3>8.10.2.2.3. 文字列<a class="headerlink" href="#string" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>文字列リテラルは <tt class="docutils literal"><span class="pre">"..."</span></tt> です。リテラル中の <tt class="docutils literal"><span class="pre">"</span></tt> は <tt class="docutils literal"><span class="pre">\"</span></tt> というように <tt class="docutils literal"><span class="pre">\</span></tt> を前につけてエスケープします。例えば、 <tt class="docutils literal"><span class="pre">"Say</span> <span class="pre">\"Hello!\"."</span></tt> は <tt class="docutils literal"><span class="pre">Say</span> <span class="pre">"Hello!".</span></tt> という文字列のリテラルです。</p> <p>文字列エンコーディングはデータベースのエンコーディングと合わせなければいけません。デフォルトのエンコーディングはUTF-8です。これは configure の <tt class="docutils literal"><span class="pre">--with-default-encoding</span></tt> オプションや <a class="reference internal" href="../executables/groonga.html"><em>groongaコマンド</em></a> の <tt class="docutils literal"><span class="pre">--encodiong</span></tt> などで変更できます。</p> </div> <div class="section" id="boolean"> <h3>8.10.2.2.4. 真偽値<a class="headerlink" href="#boolean" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>真偽値のリテラルは <tt class="docutils literal"><span class="pre">true</span></tt> と <tt class="docutils literal"><span class="pre">false</span></tt> です。 <tt class="docutils literal"><span class="pre">true</span></tt> は真という意味で、 <tt class="docutils literal"><span class="pre">false</span></tt> は偽という意味です。</p> </div> <div class="section" id="null"> <h3>8.10.2.2.5. NULL<a class="headerlink" href="#null" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>NULLのリテラルは <tt class="docutils literal"><span class="pre">null</span></tt> です。groongaはNULL値をサポートしてませんが、NULLリテラルをサポートしています。</p> </div> <div class="section" id="time"> <h3>8.10.2.2.6. 時間<a class="headerlink" href="#time" title="このヘッドラインへのパーマリンク">¶</a></h3> <div class="admonition note"> <p class="first admonition-title">ノート</p> <p class="last">これはgroonga独自の記法です。</p> </div> <p>時間のリテラルはありません。文字列での時間記法、整数での時間記法または浮動小数点数での時間記法を使ってください。</p> <p>文字列での時間記法は <tt class="docutils literal"><span class="pre">"YYYY/MM/DD</span> <span class="pre">hh:mm:ss.uuuuuu"</span></tt> または <tt class="docutils literal"><span class="pre">"YYYY-MM-DD</span> <span class="pre">hh:mm:ss.uuuuuu"</span></tt> です。 <tt class="docutils literal"><span class="pre">YYYY</span></tt> は西暦、 <tt class="docutils literal"><span class="pre">MM</span></tt> は月、 <tt class="docutils literal"><span class="pre">DD</span></tt> は日、 <tt class="docutils literal"><span class="pre">hh</span></tt> は時、 <tt class="docutils literal"><span class="pre">mm</span></tt> は分、 <tt class="docutils literal"><span class="pre">ss</span></tt> は秒、 <tt class="docutils literal"><span class="pre">uuuuuu</span></tt> はマイクロ秒です。ローカル時間です。例えば、 <tt class="docutils literal"><span class="pre">"2012/07/23</span> <span class="pre">02:41:10.436218"</span></tt> はISO 8601形式では <tt class="docutils literal"><span class="pre">2012-07-23T02:41:10.436218</span></tt> になります。</p> <p>整数での時間記法はUTC時間で1970年1月1日0時0分0秒からの経過秒数を使います。この時間はPOSIX時間とも呼ばれています。例えば、 <tt class="docutils literal"><span class="pre">1343011270</span></tt> はISO 8601形式では <tt class="docutils literal"><span class="pre">2012-07-23T02:41:10Z</span></tt> になります。</p> <p>浮動小数点数での時間記法はUTC時間で1970年1月1日0時0分0秒からの経過秒数と経過マイクロ秒数を使います。例えば、 <tt class="docutils literal"><span class="pre">1343011270.436218</span></tt> はISO 8601形式では <tt class="docutils literal"><span class="pre">2012-07-23T02:41:10.346218Z</span></tt> になります。</p> </div> <div class="section" id="geo-point"> <h3>8.10.2.2.7. 座標値<a class="headerlink" href="#geo-point" title="このヘッドラインへのパーマリンク">¶</a></h3> <div class="admonition note"> <p class="first admonition-title">ノート</p> <p class="last">これはgroonga独自の記法です。</p> </div> <p>座標値のリテラルはありません。文字列での座標値記法を使ってください。</p> <p>文字列での座標値記法には以下のパターンがあります。</p> <blockquote> <div><ul class="simple"> <li><p class="first"><tt class="docutils literal"><span class="pre">"ミリ秒表記の緯度xミリ秒表記の経度"</span></tt></p> </li> <li><p class="first"><tt class="docutils literal"><span class="pre">"ミリ秒表記の緯度,ミリ秒表記の経度"</span></tt></p> </li> <li><p class="first"><tt class="docutils literal"><span class="pre">"度数表記の緯度x度数表記の経度"</span></tt></p> </li> <li><p class="first"><tt class="docutils literal"><span class="pre">"度数表記の緯度,度数表記の経度"</span></tt></p> </li> </ul> </div></blockquote> <p><tt class="docutils literal"><span class="pre">x</span></tt> と <tt class="docutils literal"><span class="pre">,</span></tt> のどちらも区切り文字として使えます。緯度と経度はミリ秒または度数で指定します。</p> </div> <div class="section" id="array"> <h3>8.10.2.2.8. 配列<a class="headerlink" href="#array" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>配列リテラルは <tt class="docutils literal"><span class="pre">[element1,</span> <span class="pre">element2,</span> <span class="pre">...]</span></tt> です。</p> </div> <div class="section" id="object-literal"> <h3>8.10.2.2.9. オブジェクトリテラル<a class="headerlink" href="#object-literal" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>オブジェクトのリテラルは <tt class="docutils literal"><span class="pre">{name1:</span> <span class="pre">value1,</span> <span class="pre">name2:</span> <span class="pre">value2,</span> <span class="pre">...}</span></tt> です。groongaはまだオブジェクトリテラルをサポートしていません。</p> </div> </div> <div class="section" id="control-syntaxes"> <h2>8.10.2.3. 制御構文<a class="headerlink" href="#control-syntaxes" title="このヘッドラインへのパーマリンク">¶</a></h2> <p>スクリプト構文は文をサポートしていません。そのため、 <tt class="docutils literal"><span class="pre">if</span></tt> のような制御文を使うことはできません。制御用の構文は <tt class="docutils literal"><span class="pre">A</span> <span class="pre">?</span> <span class="pre">B</span> <span class="pre">:</span> <span class="pre">C</span></tt> 式だけ使うことができます。</p> <p><tt class="docutils literal"><span class="pre">A</span> <span class="pre">?</span> <span class="pre">B</span> <span class="pre">:</span> <span class="pre">C</span></tt> は <tt class="docutils literal"><span class="pre">A</span></tt> が真なら <tt class="docutils literal"><span class="pre">B</span></tt> を返して、そうでなかったら <tt class="docutils literal"><span class="pre">C</span></tt> を返します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes == (_id == 1 ? 5 : 3)' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 3 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 4, # "Good-bye Senna", # "I migrated all Senna system!", # 3 # ], # [ # 5, # "Good-bye Tritonn", # "I also migrated all Tritonn system!", # 3 # ], # [ # 1, # "The first post!", # "Welcome! This is my first post!", # 5 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">_id</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">1</span></tt> で <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">5</span></tt> または <tt class="docutils literal"><span class="pre">_id</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">1</span></tt> ではなく <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">3</span></tt> のレコードにマッチします。</p> </div> <div class="section" id="grouping"> <h2>8.10.2.4. グループ化<a class="headerlink" href="#grouping" title="このヘッドラインへのパーマリンク">¶</a></h2> <p>構文は <tt class="docutils literal"><span class="pre">(...)</span></tt> です。 <tt class="docutils literal"><span class="pre">...</span></tt> はカンマ区切りの式のリストです。</p> <p><tt class="docutils literal"><span class="pre">(...)</span></tt> は1つ以上の式をグループ化します。グループ化された式は1つの式として処理されます。 <tt class="docutils literal"><span class="pre">a</span> <span class="pre">&&</span> <span class="pre">b</span> <span class="pre">||</span> <span class="pre">c</span></tt> は <tt class="docutils literal"><span class="pre">a</span></tt> と <tt class="docutils literal"><span class="pre">b</span></tt> の両方がマッチするか、 <tt class="docutils literal"><span class="pre">c</span></tt> がマッチすれば式全体がマッチする、という意味になります。 <tt class="docutils literal"><span class="pre">a</span> <span class="pre">&&</span> <span class="pre">(b</span> <span class="pre">||</span> <span class="pre">c)</span></tt> は <tt class="docutils literal"><span class="pre">a</span></tt> がマッチして <tt class="docutils literal"><span class="pre">b</span></tt> と <tt class="docutils literal"><span class="pre">c</span></tt> はどちらか一方がマッチすれば式全体がマッチする、という意味になります。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes < 5 && content @ "senna" || content @ "fast"' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 3 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 4, # "Good-bye Senna", # "I migrated all Senna system!", # 3 # ], # [ # 2, # "Groonga", # "I started to use groonga. It's very fast!", # 10 # ], # [ # 3, # "Mroonga", # "I also started to use mroonga. It's also very fast! Really fast!", # 15 # ] # ] # ] # ] select Entries --filter 'n_likes < 5 && (content @ "senna" || content @ "fast")' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 4, # "Good-bye Senna", # "I migrated all Senna system!", # 3 # ] # ] # ] # ] </pre></div> </div> <p>最初の式はグループ化していません。この式は <tt class="docutils literal"><span class="pre">n_likes</span> <span class="pre"><</span> <span class="pre">5</span></tt> と <tt class="docutils literal"><span class="pre">content</span> <span class="pre">@</span> <span class="pre">"senna"</span></tt> の両方がマッチするか <tt class="docutils literal"><span class="pre">content</span> <span class="pre">@</span> <span class="pre">"fast"</span></tt> がマッチするレコードにマッチします。</p> <p>2番目の式はグループ化しています。この式は <tt class="docutils literal"><span class="pre">n_likes</span> <span class="pre"><</span> <span class="pre">5</span></tt> にマッチして、 <tt class="docutils literal"><span class="pre">content</span> <span class="pre">@</span> <span class="pre">"senna"</span></tt> と <tt class="docutils literal"><span class="pre">content</span> <span class="pre">@</span> <span class="pre">"fast"</span></tt> は少なくともどちらか一方にマッチするレコードにマッチします。</p> </div> <div class="section" id="function-call"> <h2>8.10.2.5. 関数呼び出し<a class="headerlink" href="#function-call" title="このヘッドラインへのパーマリンク">¶</a></h2> <p>構文は <tt class="docutils literal"><span class="pre">name(arugment1,</span> <span class="pre">argument2,</span> <span class="pre">...)</span></tt> です。</p> <p><tt class="docutils literal"><span class="pre">name(argument1,</span> <span class="pre">argument2,</span> <span class="pre">...)</span></tt> は <tt class="docutils literal"><span class="pre">name</span></tt> という関数を引数 <tt class="docutils literal"><span class="pre">argument1</span></tt>, <tt class="docutils literal"><span class="pre">argument2</span></tt>, <tt class="docutils literal"><span class="pre">...</span></tt> で呼び出します。</p> <p>利用可能な関数の一覧は <a class="reference internal" href="../function.html"><em>関数</em></a> を参照してください。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'edit_distance(_key, "Groonga") <= 1' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 2 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 2, # "Groonga", # "I started to use groonga. It's very fast!", # 10 # ], # [ # 3, # "Mroonga", # "I also started to use mroonga. It's also very fast! Really fast!", # 15 # ] # ] # ] # ] </pre></div> </div> <p>この式は <a class="reference internal" href="../functions/edit_distance.html"><em>edit_distance</em></a> を使っています。この式は <tt class="docutils literal"><span class="pre">_key</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">"Groonga"</span></tt> に似ているレコードにマッチします。 <tt class="docutils literal"><span class="pre">"Groonga"</span></tt> との類似度は編集距離で計算します。編集距離が1文字以下なら似ているとします。この場合は <tt class="docutils literal"><span class="pre">"Groonga"</span></tt> と <tt class="docutils literal"><span class="pre">"Mroonga"</span></tt> が似ている値です。</p> </div> <div class="section" id="basic-operators"> <h2>8.10.2.6. 基本的な演算子<a class="headerlink" href="#basic-operators" title="このヘッドラインへのパーマリンク">¶</a></h2> <p>groongaはECMAScriptで定義されている演算子をサポートしています。</p> <div class="section" id="arithmetic-operators"> <h3>8.10.2.6.1. 算術演算子<a class="headerlink" href="#arithmetic-operators" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>以下は算術演算子の説明です。</p> <div class="section" id="addition-operator"> <h4>8.10.2.6.1.1. 加算演算子<a class="headerlink" href="#addition-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">number1</span> <span class="pre">+</span> <span class="pre">number2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">number1</span></tt> と <tt class="docutils literal"><span class="pre">number2</span></tt> を足した結果を返します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes == 10 + 5' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 3, # "Mroonga", # "I also started to use mroonga. It's also very fast! Really fast!", # 15 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">15</span></tt> (= <tt class="docutils literal"><span class="pre">10</span> <span class="pre">+</span> <span class="pre">5</span></tt>) のレコードにマッチします。</p> </div> <div class="section" id="subtraction-operator"> <h4>8.10.2.6.1.2. 減算演算子<a class="headerlink" href="#subtraction-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">number1</span> <span class="pre">-</span> <span class="pre">number2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">number2</span></tt> から <tt class="docutils literal"><span class="pre">number1</span></tt> を引いた結果を返します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes == 20 - 5' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 3, # "Mroonga", # "I also started to use mroonga. It's also very fast! Really fast!", # 15 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">15</span></tt> (= <tt class="docutils literal"><span class="pre">20</span> <span class="pre">-</span> <span class="pre">5</span></tt>) のレコードにマッチします。</p> </div> <div class="section" id="multiplication-operator"> <h4>8.10.2.6.1.3. 乗算演算子<a class="headerlink" href="#multiplication-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">number1</span> <span class="pre">*</span> <span class="pre">number2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">number1</span></tt> と <tt class="docutils literal"><span class="pre">number2</span></tt> を掛けた結果を返します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes == 3 * 5' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 3, # "Mroonga", # "I also started to use mroonga. It's also very fast! Really fast!", # 15 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">15</span></tt> (= <tt class="docutils literal"><span class="pre">3</span> <span class="pre">*</span> <span class="pre">5</span></tt>) のレコードにマッチします。</p> </div> <div class="section" id="division-operator"> <h4>8.10.2.6.1.4. 除算演算子<a class="headerlink" href="#division-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">number1</span> <span class="pre">/</span> <span class="pre">number2</span></tt> と <tt class="docutils literal"><span class="pre">number1</span> <span class="pre">%</span> <span class="pre">number2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">number2</span></tt> を <tt class="docutils literal"><span class="pre">number1</span></tt> で割ります。 <tt class="docutils literal"><span class="pre">/</span></tt> は商を返します。 <tt class="docutils literal"><span class="pre">%</span></tt> は余りを返します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes == 26 / 7' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 2 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 4, # "Good-bye Senna", # "I migrated all Senna system!", # 3 # ], # [ # 5, # "Good-bye Tritonn", # "I also migrated all Tritonn system!", # 3 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">3</span></tt> (= <tt class="docutils literal"><span class="pre">26</span> <span class="pre">/</span> <span class="pre">7</span></tt>) のレコードにマッチします。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes == 26 % 7' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 1, # "The first post!", # "Welcome! This is my first post!", # 5 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">5</span></tt> (= <tt class="docutils literal"><span class="pre">26</span> <span class="pre">%</span> <span class="pre">7</span></tt>) の値にマッチします。</p> </div> </div> <div class="section" id="logical-operators"> <h3>8.10.2.6.2. 論理演算子<a class="headerlink" href="#logical-operators" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>以下は論理演算子の説明です。</p> <div class="section" id="logical-not-operator"> <h4>8.10.2.6.2.1. 論理否定演算子<a class="headerlink" href="#logical-not-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">!condition</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">condition</span></tt> の真偽値を反転します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter '!(n_likes == 5)' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 4 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 4, # "Good-bye Senna", # "I migrated all Senna system!", # 3 # ], # [ # 5, # "Good-bye Tritonn", # "I also migrated all Tritonn system!", # 3 # ], # [ # 2, # "Groonga", # "I started to use groonga. It's very fast!", # 10 # ], # [ # 3, # "Mroonga", # "I also started to use mroonga. It's also very fast! Really fast!", # 15 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">5</span></tt> ではない式にマッチします。</p> </div> <div class="section" id="logical-and-operator"> <h4>8.10.2.6.2.2. 論理積演算子<a class="headerlink" href="#logical-and-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">condition1</span> <span class="pre">&&</span> <span class="pre">condition2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">condition1</span></tt> と <tt class="docutils literal"><span class="pre">condition2</span></tt> の両方が真のときに真を返し、そうでなければ偽を返します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'content @ "fast" && n_likes >= 10' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 2 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 2, # "Groonga", # "I started to use groonga. It's very fast!", # 10 # ], # [ # 3, # "Mroonga", # "I also started to use mroonga. It's also very fast! Really fast!", # 15 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">content</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">fast</span></tt> を含んでいて、 <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">10</span></tt> 以上のレコードにマッチします。</p> </div> <div class="section" id="logical-or-operator"> <h4>8.10.2.6.2.3. 論理和演算子<a class="headerlink" href="#logical-or-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">condition1</span> <span class="pre">||</span> <span class="pre">condition2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">condition1</span></tt> と <tt class="docutils literal"><span class="pre">condition2</span></tt> のどちらか一方が真のときに真を返し、そうでなければ偽を返します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes == 5 || n_likes == 10' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 2 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 1, # "The first post!", # "Welcome! This is my first post!", # 5 # ], # [ # 2, # "Groonga", # "I started to use groonga. It's very fast!", # 10 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">5</span></tt> または <tt class="docutils literal"><span class="pre">10</span></tt> のレコードにマッチします。</p> </div> <div class="section" id="logical-and-not-operator"> <h4>8.10.2.6.2.4. 論理差演算子<a class="headerlink" href="#logical-and-not-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">condition1</span> <span class="pre">&!</span> <span class="pre">condition2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">condition1</span></tt> が真で <tt class="docutils literal"><span class="pre">condition2</span></tt> が偽のときに真を返し、そうでなければ偽を返します。差集合を返すということです。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'content @ "fast" &! content @ "mroonga"' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 2, # "Groonga", # "I started to use groonga. It's very fast!", # 10 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">content</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">fast</span></tt> を含んでいるが <tt class="docutils literal"><span class="pre">mroonga</span></tt> を含んでいないレコードにマッチします。</p> </div> </div> <div class="section" id="bitwise-operators"> <h3>8.10.2.6.3. ビット演算子<a class="headerlink" href="#bitwise-operators" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>以下はビット演算子の説明です。</p> <div class="section" id="bitwise-not-operator"> <h4>8.10.2.6.3.1. ビット否定演算子<a class="headerlink" href="#bitwise-not-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">~number</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">number</span></tt> の各ビットを反転した結果を返します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter '~n_likes == -6' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 1, # "The first post!", # "Welcome! This is my first post!", # 5 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">5</span></tt> のレコードにマッチします。なぜならば、 <tt class="docutils literal"><span class="pre">5</span></tt> の各ビットを反転すると <tt class="docutils literal"><span class="pre">-6</span></tt> になるからです。</p> </div> <div class="section" id="bitwise-and-operator"> <h4>8.10.2.6.3.2. ビット論理積演算子<a class="headerlink" href="#bitwise-and-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">number1</span> <span class="pre">&</span> <span class="pre">number2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">number1</span></tt> と <tt class="docutils literal"><span class="pre">number2</span></tt> をビット単位で論理積をした結果を返します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter '(n_likes & 1) == 1' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 4 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 4, # "Good-bye Senna", # "I migrated all Senna system!", # 3 # ], # [ # 5, # "Good-bye Tritonn", # "I also migrated all Tritonn system!", # 3 # ], # [ # 3, # "Mroonga", # "I also started to use mroonga. It's also very fast! Really fast!", # 15 # ], # [ # 1, # "The first post!", # "Welcome! This is my first post!", # 5 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が偶数のレコードにマッチします。なぜならば、偶数と <tt class="docutils literal"><span class="pre">1</span></tt> のビット単位の論理積は <tt class="docutils literal"><span class="pre">1</span></tt> になり、奇数と <tt class="docutils literal"><span class="pre">1</span></tt> のビット単位の論理積は <tt class="docutils literal"><span class="pre">0</span></tt> になるからです。</p> </div> </div> <div class="section" id="bitwise-or-operator"> <h3>8.10.2.6.4. ビット論理和演算子<a class="headerlink" href="#bitwise-or-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">number1</span> <span class="pre">|</span> <span class="pre">number2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">number1</span></tt> と <tt class="docutils literal"><span class="pre">number2</span></tt> をビット単位で論理和した結果を返します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes == (1 | 4)' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 1, # "The first post!", # "Welcome! This is my first post!", # 5 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">5</span></tt> (= <tt class="docutils literal"><span class="pre">1</span> <span class="pre">|</span> <span class="pre">4</span></tt>) のレコードにマッチします。</p> </div> <div class="section" id="bitwise-xor-operator"> <h3>8.10.2.6.5. ビット排他的論理和演算子<a class="headerlink" href="#bitwise-xor-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">number1</span> <span class="pre">^</span> <span class="pre">number2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">number1</span></tt> と <tt class="docutils literal"><span class="pre">number2</span></tt> をビット単位で排他的論理和した結果を返します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes == (10 ^ 15)' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 1, # "The first post!", # "Welcome! This is my first post!", # 5 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">5</span></tt> (= <tt class="docutils literal"><span class="pre">10</span> <span class="pre">^</span> <span class="pre">15</span></tt>) の値にマッチします。</p> </div> <div class="section" id="shift-operators"> <h3>8.10.2.6.6. シフト演算子<a class="headerlink" href="#shift-operators" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>以下はシフト演算子の説明です。</p> <div class="section" id="left-shift-operator"> <h4>8.10.2.6.6.1. 左シフト演算子<a class="headerlink" href="#left-shift-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">number1</span> <span class="pre"><<</span> <span class="pre">number2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">number1</span></tt> のビットを左に <tt class="docutils literal"><span class="pre">number2</span></tt> ビットシフトする。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes == (5 << 1)' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 2, # "Groonga", # "I started to use groonga. It's very fast!", # 10 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">10</span></tt> (= <tt class="docutils literal"><span class="pre">5</span> <span class="pre"><<</span> <span class="pre">1</span></tt>) のレコードにマッチします。</p> </div> <div class="section" id="signed-right-shift-operator"> <h4>8.10.2.6.6.2. 符号付き右シフト演算子<a class="headerlink" href="#signed-right-shift-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">number1</span> <span class="pre">>></span> <span class="pre">number2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">number1</span></tt> のビットを右に <tt class="docutils literal"><span class="pre">number2</span></tt> ビットシフトします。結果の符号は <tt class="docutils literal"><span class="pre">number1</span></tt> の符号と同じです。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes == -(-10 >> 1)' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 1, # "The first post!", # "Welcome! This is my first post!", # 5 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">5</span></tt> (= <tt class="docutils literal"><span class="pre">-(-10</span> <span class="pre">>></span> <span class="pre">1)</span></tt> = <tt class="docutils literal"><span class="pre">-(-5)</span></tt>) のレコードにマッチします。</p> </div> <div class="section" id="unsigned-right-shift-operator"> <h4>8.10.2.6.6.3. 符号なし右シフト演算子<a class="headerlink" href="#unsigned-right-shift-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">number1</span> <span class="pre">>>></span> <span class="pre">number2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">number1</span></tt> のビットを右に <tt class="docutils literal"><span class="pre">number2</span></tt> ビットシフトします。一番左の <tt class="docutils literal"><span class="pre">number2</span></tt> ビットには <tt class="docutils literal"><span class="pre">0</span></tt> が入ります。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes == (2147483648 - (-10 >>> 1))' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 1, # "The first post!", # "Welcome! This is my first post!", # 5 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">5</span></tt> (= <tt class="docutils literal"><span class="pre">2147483648</span> <span class="pre">-</span> <span class="pre">(-10</span> <span class="pre">>>></span> <span class="pre">1)</span></tt> = <tt class="docutils literal"><span class="pre">2147483648</span> <span class="pre">-</span> <span class="pre">2147483643</span></tt>) のレコードにマッチします。</p> </div> </div> <div class="section" id="comparison-operators"> <h3>8.10.2.6.7. 比較演算子<a class="headerlink" href="#comparison-operators" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>以下は比較演算子の説明です。</p> <div class="section" id="equal-operator"> <h4>8.10.2.6.7.1. 等価演算子<a class="headerlink" href="#equal-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">object1</span> <span class="pre">==</span> <span class="pre">object2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">object1</span></tt> が <tt class="docutils literal"><span class="pre">object2</span></tt> と等しいときは真を返し、そうでなければ偽を返します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes == 5' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 1, # "The first post!", # "Welcome! This is my first post!", # 5 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">5</span></tt> の値にマッチします。</p> </div> <div class="section" id="not-equal-operator"> <h4>8.10.2.6.7.2. 不等価演算子<a class="headerlink" href="#not-equal-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>構文は <tt class="docutils literal"><span class="pre">object1</span> <span class="pre">!=</span> <span class="pre">object2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">object1</span></tt> が <tt class="docutils literal"><span class="pre">object2</span></tt> と等しくないときに真を返し、そうでなければ偽を返します。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'n_likes != 5' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 4 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "_key", # "ShortText" # ], # [ # "content", # "Text" # ], # [ # "n_likes", # "UInt32" # ] # ], # [ # 4, # "Good-bye Senna", # "I migrated all Senna system!", # 3 # ], # [ # 5, # "Good-bye Tritonn", # "I also migrated all Tritonn system!", # 3 # ], # [ # 2, # "Groonga", # "I started to use groonga. It's very fast!", # 10 # ], # [ # 3, # "Mroonga", # "I also started to use mroonga. It's also very fast! Really fast!", # 15 # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">n_likes</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">5</span></tt> ではない式にマッチします。</p> </div> <div class="section" id="less-than-operator"> <h4>8.10.2.6.7.3. 小なり演算子<a class="headerlink" href="#less-than-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>TODO: ...</p> </div> <div class="section" id="less-than-or-equal-to-operator"> <h4>8.10.2.6.7.4. 以下演算子<a class="headerlink" href="#less-than-or-equal-to-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>TODO: ...</p> </div> <div class="section" id="greater-than-operator"> <h4>8.10.2.6.7.5. 大なり演算子<a class="headerlink" href="#greater-than-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>TODO: ...</p> </div> <div class="section" id="greater-than-or-equal-to-operator"> <h4>8.10.2.6.7.6. 以上演算子<a class="headerlink" href="#greater-than-or-equal-to-operator" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>TODO: ...</p> </div> </div> </div> <div class="section" id="assignment-operators"> <h2>8.10.2.7. 代入演算子<a class="headerlink" href="#assignment-operators" title="このヘッドラインへのパーマリンク">¶</a></h2> <div class="section" id="addition-assignment-operator"> <h3>8.10.2.7.1. 加算代入演算子<a class="headerlink" href="#addition-assignment-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column</span> <span class="pre">+=</span> <span class="pre">value</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">column1</span></tt> に <tt class="docutils literal"><span class="pre">column2</span></tt> を加算代入します。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns _key,n_likes,_score --filter true --scorer '_score += n_likes' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 5 # ], # [ # [ # "_key", # "ShortText" # ], # [ # "n_likes", # "UInt32" # ], # [ # "_score", # "Int32" # ] # ], # [ # "Good-bye Senna", # 3, # 4 # ], # [ # "Good-bye Tritonn", # 3, # 4 # ], # [ # "Groonga", # 10, # 11 # ], # [ # "Mroonga", # 15, # 16 # ], # [ # "The first post!", # 5, # 6 # ] # ] # ] # ] </pre></div> </div> <p><tt class="docutils literal"><span class="pre">--filter</span></tt> による <tt class="docutils literal"><span class="pre">_score</span></tt> の値はこの場合は常に1です。その後、'_score = _score + n_likes' という加算代入演算をそれぞれのレコードへ適用します。</p> <p>例えば、 <tt class="docutils literal"><span class="pre">_key</span></tt> として"Good-bye Senna"を格納しているレコードの <tt class="docutils literal"><span class="pre">_score</span></tt> の値は3です。</p> <p>そのため、 <tt class="docutils literal"><span class="pre">1</span> <span class="pre">+</span> <span class="pre">3</span></tt> という式が評価されてから <tt class="docutils literal"><span class="pre">_score</span></tt> カラムへと演算結果が保存されます。</p> </div> <div class="section" id="subtraction-assignment-operator"> <h3>8.10.2.7.2. 減算代入演算子<a class="headerlink" href="#subtraction-assignment-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column1</span> <span class="pre">-=</span> <span class="pre">column2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">column1</span></tt> から <tt class="docutils literal"><span class="pre">column2</span></tt> を減算代入します。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns _key,n_likes,_score --filter true --scorer '_score -= n_likes' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 5 # ], # [ # [ # "_key", # "ShortText" # ], # [ # "n_likes", # "UInt32" # ], # [ # "_score", # "Int32" # ] # ], # [ # "Good-bye Senna", # 3, # -2 # ], # [ # "Good-bye Tritonn", # 3, # -2 # ], # [ # "Groonga", # 10, # -9 # ], # [ # "Mroonga", # 15, # -14 # ], # [ # "The first post!", # 5, # -4 # ] # ] # ] # ] </pre></div> </div> <p><tt class="docutils literal"><span class="pre">--filter</span></tt> による <tt class="docutils literal"><span class="pre">_score</span></tt> の値はこの場合は常に1です。その後、'_score = _score - n_likes' という減算代入演算をそれぞれのレコードへ適用します。</p> <p>例えば、 <tt class="docutils literal"><span class="pre">_key</span></tt> として"Good-bye Senna"を格納しているレコードの <tt class="docutils literal"><span class="pre">_score</span></tt> の値は3です。</p> <p>そのため、 <tt class="docutils literal"><span class="pre">1</span> <span class="pre">-</span> <span class="pre">3</span></tt> という式が評価されてから <tt class="docutils literal"><span class="pre">_score</span></tt> カラムへと演算結果が保存されます。</p> </div> <div class="section" id="multiplication-assignment-operator"> <h3>8.10.2.7.3. 乗算代入演算子<a class="headerlink" href="#multiplication-assignment-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column1</span> <span class="pre">*=</span> <span class="pre">column2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">column1</span></tt> に <tt class="docutils literal"><span class="pre">column2</span></tt> を乗算演算する。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns _key,n_likes,_score --filter true --scorer '_score *= n_likes' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 5 # ], # [ # [ # "_key", # "ShortText" # ], # [ # "n_likes", # "UInt32" # ], # [ # "_score", # "Int32" # ] # ], # [ # "Good-bye Senna", # 3, # 3 # ], # [ # "Good-bye Tritonn", # 3, # 3 # ], # [ # "Groonga", # 10, # 10 # ], # [ # "Mroonga", # 15, # 15 # ], # [ # "The first post!", # 5, # 5 # ] # ] # ] # ] </pre></div> </div> <p><tt class="docutils literal"><span class="pre">--filter</span></tt> による <tt class="docutils literal"><span class="pre">_score</span></tt> の値はこの場合は常に1です。その後、'_score = _score * n_likes' という乗算代入演算をそれぞれのレコードへ適用します。</p> <p>例えば、 <tt class="docutils literal"><span class="pre">_key</span></tt> として"Good-bye Senna"を格納しているレコードの <tt class="docutils literal"><span class="pre">_score</span></tt> の値は3です。</p> <p>そのため、 <tt class="docutils literal"><span class="pre">1</span> <span class="pre">*</span> <span class="pre">3</span></tt> という式が評価されてから <tt class="docutils literal"><span class="pre">_score</span></tt> カラムへと演算結果が保存されます。</p> </div> <div class="section" id="division-assignment-operator"> <h3>8.10.2.7.4. 除算代入演算子<a class="headerlink" href="#division-assignment-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column1</span> <span class="pre">/=</span> <span class="pre">column2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">column1</span></tt> に <tt class="docutils literal"><span class="pre">column2</span></tt> を除算代入します。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns _key,n_likes,_score --filter true --scorer '_score /= n_likes' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 5 # ], # [ # [ # "_key", # "ShortText" # ], # [ # "n_likes", # "UInt32" # ], # [ # "_score", # "Int32" # ] # ], # [ # "Good-bye Senna", # 3, # 0 # ], # [ # "Good-bye Tritonn", # 3, # 0 # ], # [ # "Groonga", # 10, # 0 # ], # [ # "Mroonga", # 15, # 0 # ], # [ # "The first post!", # 5, # 0 # ] # ] # ] # ] </pre></div> </div> <p><tt class="docutils literal"><span class="pre">--filter</span></tt> による <tt class="docutils literal"><span class="pre">_score</span></tt> の値はこの場合は常に1です。その後、'_score = _score / n_likes' という除算代入演算をそれぞれのレコードへ適用します。</p> <p>例えば、 <tt class="docutils literal"><span class="pre">_key</span></tt> として"Good-bye Senna"を格納しているレコードの <tt class="docutils literal"><span class="pre">_score</span></tt> の値は3です。</p> <p>そのため、 <tt class="docutils literal"><span class="pre">1</span> <span class="pre">/</span> <span class="pre">3</span></tt> という式が評価されてから <tt class="docutils literal"><span class="pre">_score</span></tt> カラムへと演算結果が保存されます。</p> </div> <div class="section" id="modulo-assignment-operator"> <h3>8.10.2.7.5. 剰余代入演算子<a class="headerlink" href="#modulo-assignment-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column1</span> <span class="pre">%=</span> <span class="pre">column2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">column1</span></tt> に <tt class="docutils literal"><span class="pre">column2</span></tt> を剰余代入します。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns _key,n_likes,_score --filter true --scorer '_score %= n_likes' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 5 # ], # [ # [ # "_key", # "ShortText" # ], # [ # "n_likes", # "UInt32" # ], # [ # "_score", # "Int32" # ] # ], # [ # "Good-bye Senna", # 3, # 1 # ], # [ # "Good-bye Tritonn", # 3, # 1 # ], # [ # "Groonga", # 10, # 1 # ], # [ # "Mroonga", # 15, # 1 # ], # [ # "The first post!", # 5, # 1 # ] # ] # ] # ] </pre></div> </div> <p><tt class="docutils literal"><span class="pre">--filter</span></tt> による <tt class="docutils literal"><span class="pre">_score</span></tt> の値はこの場合は常に1です。その後、'_score = _score % n_likes' という除算代入演算をそれぞれのレコードへ適用します。</p> <p>例えば、 <tt class="docutils literal"><span class="pre">_key</span></tt> として"Good-bye Senna"を格納しているレコードの <tt class="docutils literal"><span class="pre">_score</span></tt> の値は3です。</p> <p>そのため、 <tt class="docutils literal"><span class="pre">1</span> <span class="pre">%</span> <span class="pre">3</span></tt> という式が評価されてから <tt class="docutils literal"><span class="pre">_score</span></tt> カラムへと演算結果が保存されます。</p> </div> <div class="section" id="bitwise-left-shift-assignment-operator"> <h3>8.10.2.7.6. 左シフト代入演算子<a class="headerlink" href="#bitwise-left-shift-assignment-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column1</span> <span class="pre"><<</span> <span class="pre">column2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">column1</span></tt> のビットを左に <tt class="docutils literal"><span class="pre">column2</span></tt> 左ビットシフト代入演算します。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns _key,n_likes,_score --filter true --scorer '_score <<= n_likes' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 5 # ], # [ # [ # "_key", # "ShortText" # ], # [ # "n_likes", # "UInt32" # ], # [ # "_score", # "Int32" # ] # ], # [ # "Good-bye Senna", # 3, # 8 # ], # [ # "Good-bye Tritonn", # 3, # 8 # ], # [ # "Groonga", # 10, # 1024 # ], # [ # "Mroonga", # 15, # 32768 # ], # [ # "The first post!", # 5, # 32 # ] # ] # ] # ] </pre></div> </div> <p><tt class="docutils literal"><span class="pre">--filter</span></tt> による <tt class="docutils literal"><span class="pre">_score</span></tt> の値はこの場合は常に1です。その後、'_score = _score << n_likes' という左ビットシフト代入演算をそれぞれのレコードへ適用します。</p> <p>例えば、 <tt class="docutils literal"><span class="pre">_key</span></tt> として"Good-bye Senna"を格納しているレコードの <tt class="docutils literal"><span class="pre">_score</span></tt> の値は3です。</p> <p>そのため、 <tt class="docutils literal"><span class="pre">1</span> <span class="pre"><<</span> <span class="pre">3</span></tt> という式が評価されてから <tt class="docutils literal"><span class="pre">_score</span></tt> カラムへと演算結果が保存されます。</p> </div> <div class="section" id="bitwise-signed-right-shift-assignment-operator"> <h3>8.10.2.7.7. 符号あり右シフト代入演算子<a class="headerlink" href="#bitwise-signed-right-shift-assignment-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column1</span> <span class="pre">>>=</span> <span class="pre">column2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">column1</span></tt> のビットを <tt class="docutils literal"><span class="pre">column2</span></tt> 右ビットシフト代入演算します。</p> </div> <div class="section" id="bitwise-unsigned-right-shift-assignment-operator"> <h3>8.10.2.7.8. 符号なし右シフト代入演算子<a class="headerlink" href="#bitwise-unsigned-right-shift-assignment-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column1</span> <span class="pre">>>>=</span> <span class="pre">column2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">column1</span></tt> のビットを <tt class="docutils literal"><span class="pre">column2</span></tt> 符号なし右ビットシフト代入演算します。</p> </div> <div class="section" id="bitwise-and-assignment-operator"> <h3>8.10.2.7.9. ビット論理積代入演算子<a class="headerlink" href="#bitwise-and-assignment-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column1</span> <span class="pre">&=</span> <span class="pre">column2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">column1</span></tt> に <tt class="docutils literal"><span class="pre">column2</span></tt> をビット論理積代入演算します。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns _key,n_likes,_score --filter true --scorer '_score &= n_likes' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 5 # ], # [ # [ # "_key", # "ShortText" # ], # [ # "n_likes", # "UInt32" # ], # [ # "_score", # "Int32" # ] # ], # [ # "Good-bye Senna", # 3, # 1 # ], # [ # "Good-bye Tritonn", # 3, # 1 # ], # [ # "Groonga", # 10, # 0 # ], # [ # "Mroonga", # 15, # 1 # ], # [ # "The first post!", # 5, # 1 # ] # ] # ] # ] </pre></div> </div> <p><tt class="docutils literal"><span class="pre">--filter</span></tt> による <tt class="docutils literal"><span class="pre">_score</span></tt> の値はこの場合は常に1です。その後、'_score = _score & n_likes' というビット論理積代入演算をそれぞれのレコードへ適用します。</p> <p>例えば、 <tt class="docutils literal"><span class="pre">_key</span></tt> として"Groonga"を格納しているレコードの値は10です。</p> <p>そのため、 <tt class="docutils literal"><span class="pre">1</span> <span class="pre">&</span> <span class="pre">10</span></tt> という式が評価されてから <tt class="docutils literal"><span class="pre">_score</span></tt> カラムへと演算結果が保存されます。</p> </div> <div class="section" id="bitwise-or-assignment-operator"> <h3>8.10.2.7.10. ビット論理和代入演算子<a class="headerlink" href="#bitwise-or-assignment-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column1</span> <span class="pre">|=</span> <span class="pre">column2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">column1</span></tt> に <tt class="docutils literal"><span class="pre">column2</span></tt> をビット論理和代入演算する。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns _key,n_likes,_score --filter true --scorer '_score |= n_likes' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 5 # ], # [ # [ # "_key", # "ShortText" # ], # [ # "n_likes", # "UInt32" # ], # [ # "_score", # "Int32" # ] # ], # [ # "Good-bye Senna", # 3, # 3 # ], # [ # "Good-bye Tritonn", # 3, # 3 # ], # [ # "Groonga", # 10, # 11 # ], # [ # "Mroonga", # 15, # 15 # ], # [ # "The first post!", # 5, # 5 # ] # ] # ] # ] </pre></div> </div> <p><tt class="docutils literal"><span class="pre">--filter</span></tt> による <tt class="docutils literal"><span class="pre">_score</span></tt> の値はこの場合は常に1です。その後、'_score = _score | n_likes' というビット論理和代入演算をそれぞれのレコードへ適用します。</p> <p>例えば、 <tt class="docutils literal"><span class="pre">_key</span></tt> として"Groonga"を格納しているレコードの値は10です。</p> <p>そのため、 <tt class="docutils literal"><span class="pre">1</span> <span class="pre">|</span> <span class="pre">10</span></tt> という式が評価されてから <tt class="docutils literal"><span class="pre">_score</span></tt> カラムへと演算結果が保存されます。</p> </div> <div class="section" id="bitwise-xor-assignment-operator"> <h3>8.10.2.7.11. ビット排他的論理和代入演算子<a class="headerlink" href="#bitwise-xor-assignment-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column1</span> <span class="pre">^=</span> <span class="pre">column2</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">column1</span></tt> に <tt class="docutils literal"><span class="pre">column2</span></tt> をビット排他的論理和代入演算します。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --output_columns _key,n_likes,_score --filter true --scorer '_score ^= n_likes' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 5 # ], # [ # [ # "_key", # "ShortText" # ], # [ # "n_likes", # "UInt32" # ], # [ # "_score", # "Int32" # ] # ], # [ # "Good-bye Senna", # 3, # 2 # ], # [ # "Good-bye Tritonn", # 3, # 2 # ], # [ # "Groonga", # 10, # 11 # ], # [ # "Mroonga", # 15, # 14 # ], # [ # "The first post!", # 5, # 4 # ] # ] # ] # ] </pre></div> </div> <p><tt class="docutils literal"><span class="pre">--filter</span></tt> による <tt class="docutils literal"><span class="pre">_score</span></tt> の値はこの場合は常に1です。その後、'_score = _score ^ n_likes' という減算代入演算をそれぞれのレコードへ適用します。</p> <p>例えば、 <tt class="docutils literal"><span class="pre">_key</span></tt> として"Good-bye Senna"を格納しているレコードの <tt class="docutils literal"><span class="pre">_score</span></tt> の値は3です。</p> <p>そのため、 <tt class="docutils literal"><span class="pre">1</span> <span class="pre">^</span> <span class="pre">3</span></tt> という式が評価されてから <tt class="docutils literal"><span class="pre">_score</span></tt> カラムへと演算結果が保存されます。</p> </div> </div> <div class="section" id="original-operators"> <h2>8.10.2.8. 独自の演算子<a class="headerlink" href="#original-operators" title="このヘッドラインへのパーマリンク">¶</a></h2> <p>スクリプト構文はECMAScriptの構文に独自の二項演算子を追加しています。これらは検索に特化した操作をします。演算子の最初の文字は <tt class="docutils literal"><span class="pre">@</span></tt> または <tt class="docutils literal"><span class="pre">*</span></tt> です。</p> <div class="section" id="match-operator"> <span id="match-oeprator"></span><h3>8.10.2.8.1. マッチ演算子<a class="headerlink" href="#match-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column</span> <span class="pre">@</span> <span class="pre">value</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">column</span></tt> の転置インデックスを使って <tt class="docutils literal"><span class="pre">value</span></tt> を検索します。普通は全文検索をしますが、タグ検索もできます。これは、タグ検索も転置インデックスを使って実現しているからです。</p> <p><a class="reference internal" href="query_syntax.html"><em>クエリー構文</em></a> はデフォルトでこの演算子を使っています。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'content @ "fast"' --output_columns content # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 2 # ], # [ # [ # "content", # "Text" # ] # ], # [ # "I started to use groonga. It's very fast!" # ], # [ # "I also started to use mroonga. It's also very fast! Really fast!" # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">content</span></tt> カラムの値に <tt class="docutils literal"><span class="pre">fast</span></tt> という単語を含んでいるレコードにマッチします。</p> </div> <div class="section" id="prefix-search-operator"> <span id="id1"></span><h3>8.10.2.8.2. 前方一致検索演算子<a class="headerlink" href="#prefix-search-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column</span> <span class="pre">@^</span> <span class="pre">value</span></tt> です。</p> <p>この条件式は <tt class="docutils literal"><span class="pre">value</span></tt> で前方一致検索します。前方一致検索は <tt class="docutils literal"><span class="pre">value</span></tt> で始まる単語を含むレコードを検索します。</p> <p>カラムの値を高速に前方一致検索できます。ただし、そのカラムにはインデックスを作成し、そのインデックス用のテーブルをパトリシアトライ( <tt class="docutils literal"><span class="pre">TABLE_PAT_KEY</span></tt> )またはダブル配列トライ( <tt class="docutils literal"><span class="pre">TABLE_DAT_KEY</span></tt> )にしなければいけません。あるいは、パトリシアトライテーブルまたはダブル配列テーブルの <tt class="docutils literal"><span class="pre">_key</span></tt> も高速に前方一致検索できます。 <tt class="docutils literal"><span class="pre">_key</span></tt> にインデックスを作成する必要はありません。</p> <p>他の種類のテーブルでも前方一致検索を使えますがレコード全件を処理します。レコード数が少ない場合には問題ありませんが、レコード数が多いと時間がかかります。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter '_key @^ "Goo"' --output_columns _key # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 2 # ], # [ # [ # "_key", # "ShortText" # ] # ], # [ # "Good-bye Tritonn" # ], # [ # "Good-bye Senna" # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">_key</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">Goo</span></tt> で始まる単語を含むレコードにマッチします。この式には <tt class="docutils literal"><span class="pre">Good-bye</span> <span class="pre">Senna</span></tt> と <tt class="docutils literal"><span class="pre">Good-bye</span> <span class="pre">Tritonn</span></tt> がマッチします。</p> </div> <div class="section" id="suffix-search-operator"> <span id="id2"></span><h3>8.10.2.8.3. 後方一致検索演算子<a class="headerlink" href="#suffix-search-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column</span> <span class="pre">@$</span> <span class="pre">value</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">value</span></tt> で後方一致検索します。後方一致検索は <tt class="docutils literal"><span class="pre">value</span></tt> で終わる単語を含むレコードを検索します。</p> <p>カラムの値を高速に後方一致検索できます。ただし、そのカラムにはインデックスを作成し、そのインデックス用のテーブルを <tt class="docutils literal"><span class="pre">KEY_WITH_SIS</span></tt> フラグ付きのパトリシアトライテーブル( <tt class="docutils literal"><span class="pre">TABLE_PAT_KEY</span></tt> )にしなければいけません。 <tt class="docutils literal"><span class="pre">KEY_WITH_SIS</span></tt> フラグ付きのパトリシアトライテーブル( <tt class="docutils literal"><span class="pre">TABLE_PAT_KEY</span></tt> )の <tt class="docutils literal"><span class="pre">_key</span></tt> 擬似カラムの値も高速に後方一致検索できます。 <tt class="docutils literal"><span class="pre">_key</span></tt> にはインデックスを作成する必要はありません。 <tt class="docutils literal"><span class="pre">_key</span></tt> ベースの高速な後方一致検索よりもカラムベースの高速な後方一致検索を使うことをおすすめします。 <tt class="docutils literal"><span class="pre">_key</span></tt> ベースの高速な後方一致検索は自動的に登録された部分文字列も返ってきます。(TODO: 後方一致検索に関するドキュメントを書いてここからリンクを張る。)</p> <div class="admonition note"> <p class="first admonition-title">ノート</p> <p class="last">高速な後方一致検索は日本語のひらがななど非ASCII文字にしか使えません。ASCII文字には高速な後方一致検索を使えません。</p> </div> <p>後方一致検索は他の種類のテーブルもしくはパトリシアトライを <tt class="docutils literal"><span class="pre">KEY_WITH_SIS</span></tt> フラグなしで使用しているテーブルに対しても使えますが、レコード全件を処理します。レコード数が少ない場合には問題ありませんが、レコード数が多いと時間がかかります。</p> <p>簡単な例です。ASCII文字ではない文字である日本語のひらがなに対して高速な後方一致検索をしています。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>table_create Titles TABLE_NO_KEY # [[0, 1337566253.89858, 0.000355720520019531], true] column_create Titles content COLUMN_SCALAR ShortText # [[0, 1337566253.89858, 0.000355720520019531], true] table_create SuffixSearchTerms TABLE_PAT_KEY|KEY_WITH_SIS ShortText # [[0, 1337566253.89858, 0.000355720520019531], true] column_create SuffixSearchTerms index COLUMN_INDEX Titles content # [[0, 1337566253.89858, 0.000355720520019531], true] load --table Titles [ {"content": "ぐるんが"}, {"content": "むるんが"}, {"content": "せな"}, {"content": "とりとん"} ] # [[0, 1337566253.89858, 0.000355720520019531], 4] select Titles --query 'content:$んが' # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 2 # ], # [ # [ # "_id", # "UInt32" # ], # [ # "content", # "ShortText" # ] # ], # [ # 2, # "むるんが" # ], # [ # 1, # "ぐるんが" # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">content</span></tt> カラムの値が <tt class="docutils literal"><span class="pre">んが</span></tt> で終わるレコードにマッチします。この場合は <tt class="docutils literal"><span class="pre">ぐるんが</span></tt> と <tt class="docutils literal"><span class="pre">むるんが</span></tt> にマッチします。</p> </div> <div class="section" id="near-search-operator"> <span id="id3"></span><h3>8.10.2.8.4. 近傍検索演算子<a class="headerlink" href="#near-search-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column</span> <span class="pre">*N</span> <span class="pre">"word1</span> <span class="pre">word2</span> <span class="pre">..."</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">word1</span> <span class="pre">word2</span> <span class="pre">...</span></tt> という単語で近傍検索します。近傍検索はすべての単語が含まれていてかつそれぞれの単語が近くにあるレコードを検索します。距離が <tt class="docutils literal"><span class="pre">10</span></tt> 以内の近さであれば近くにあると判断します。今のところ、この値は変更できません。距離の単位はN-gram系のトークナイザーでは文字数で、形態素解析系のトークナイザーでは単語数です。</p> <p>(TODO: <tt class="docutils literal"><span class="pre">TokenBigram</span></tt> はASCIIだけの単語はトークンに分割しないという説明を追加すること。このため、 <tt class="docutils literal"><span class="pre">TokenBigram</span></tt> はN-gram系のトークナイザーだけどASCIIだけの単語を扱う時の単位は単語数になる。)</p> <p><tt class="docutils literal"><span class="pre">column</span></tt> 用の全文検索用インデックスカラムを定義しておく必要があることに注意してください。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'content *N "I fast"' --output_columns content # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "content", # "Text" # ] # ], # [ # "I started to use groonga. It's very fast!" # ] # ] # ] # ] select Entries --filter 'content *N "I Really"' --output_columns content # [[0, 1337566253.89858, 0.000355720520019531], [[[0], [["content", "Text"]]]]] select Entries --filter 'content *N "also Really"' --output_columns content # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 1 # ], # [ # [ # "content", # "Text" # ] # ], # [ # "I also started to use mroonga. It's also very fast! Really fast!" # ] # ] # ] # ] </pre></div> </div> <p>最初の式は <tt class="docutils literal"><span class="pre">I</span></tt> と <tt class="docutils literal"><span class="pre">fast</span></tt> が含まれていて、かつ、これらの単語が10単語以内近くにあるレコードにマッチします。そのため <tt class="docutils literal"><span class="pre">I</span> <span class="pre">also</span> <span class="pre">started</span> <span class="pre">to</span> <span class="pre">use</span> <span class="pre">mroonga.</span> <span class="pre">It's</span> <span class="pre">also</span> <span class="pre">very</span> <span class="pre">fast!</span> <span class="pre">...</span></tt> にマッチします。 <tt class="docutils literal"><span class="pre">I</span></tt> と <tt class="docutils literal"><span class="pre">fast</span></tt> の間の単語数はちょうど10です。</p> <p>二番目の式は <tt class="docutils literal"><span class="pre">I</span></tt> と <tt class="docutils literal"><span class="pre">Really</span></tt> が含まれていて、かつ、これらの単語が10単語以内近くにあるレコードにマッチします。そのため、 <tt class="docutils literal"><span class="pre">I</span> <span class="pre">also</span> <span class="pre">st</span> <span class="pre">arted</span> <span class="pre">to</span> <span class="pre">use</span> <span class="pre">mroonga.</span> <span class="pre">It's</span> <span class="pre">also</span> <span class="pre">very</span> <span class="pre">fast!</span> <span class="pre">Really</span> <span class="pre">fast!</span></tt> はマッチしません。 <tt class="docutils literal"><span class="pre">I</span></tt> と <tt class="docutils literal"><span class="pre">Really</span></tt> の間の単語数は11です。</p> <p>三番目の式は <tt class="docutils literal"><span class="pre">also</span></tt> と <tt class="docutils literal"><span class="pre">Really</span></tt> が含まれていて、かつ、これらの単語が10単語以内近くにあるレコードにマッチします。そのため、 <tt class="docutils literal"><span class="pre">I</span> <span class="pre">also</span> <span class="pre">started</span> <span class="pre">to</span> <span class="pre">use</span> <span class="pre">mroonga.</span> <span class="pre">It's</span> <span class="pre">also</span> <span class="pre">very</span> <span class="pre">fast!</span> <span class="pre">Really</span> <span class="pre">fast!</span></tt> にマッチします。 <tt class="docutils literal"><span class="pre">also</span></tt> と <tt class="docutils literal"><span class="pre">Really</span></tt> の間の単語数は10です。</p> </div> <div class="section" id="similar-search"> <span id="similar-search-operator"></span><h3>8.10.2.8.5. 類似文書検索<a class="headerlink" href="#similar-search" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">column</span> <span class="pre">*S</span> <span class="pre">"document"</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">document</span></tt> という文書で類似文書検索します。類似文書検索は <tt class="docutils literal"><span class="pre">document</span></tt> と似た内容を持つレコードを検索します。</p> <p><tt class="docutils literal"><span class="pre">column</span></tt> 用の全文検索用インデックスカラムを定義しておく必要があることに注意してください。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>select Entries --filter 'content *S "I migrated all Solr system!"' --output_columns content # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 2 # ], # [ # [ # "content", # "Text" # ] # ], # [ # "I migrated all Senna system!" # ], # [ # "I also migrated all Tritonn system!" # ] # ] # ] # ] </pre></div> </div> <p>この式は <tt class="docutils literal"><span class="pre">I</span> <span class="pre">migrated</span> <span class="pre">all</span> <span class="pre">Solr</span> <span class="pre">system!</span></tt> と似た内容を持つレコードを検索します。この場合は、 <tt class="docutils literal"><span class="pre">I</span> <span class="pre">migrated</span> <span class="pre">all</span> <span class="pre">XXX</span> <span class="pre">system!</span></tt> という内容のレコードがマッチします。</p> </div> <div class="section" id="term-extract-operator"> <span id="id4"></span><h3>8.10.2.8.6. 単語抽出演算子<a class="headerlink" href="#term-extract-operator" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>構文は <tt class="docutils literal"><span class="pre">_key</span> <span class="pre">*T</span> <span class="pre">"document"</span></tt> です。</p> <p>この演算子は <tt class="docutils literal"><span class="pre">document</span></tt> から単語を抽出します。単語は <tt class="docutils literal"><span class="pre">_key</span></tt> のテーブルのキーとして登録されていなければいけません。</p> <p>テーブルはパトリシアトライ( <tt class="docutils literal"><span class="pre">TABLE_PAT_KEY</span></tt> )またはダブル配列トライ( <tt class="docutils literal"><span class="pre">TABLE_DAT_KEY</span></tt> )でなければいけません。ハッシュテーブル( <tt class="docutils literal"><span class="pre">TABLE_HASH_KEY</span></tt> )や配列( <tt class="docutils literal"><span class="pre">TABLE_NO_KEY</span></tt> )は最長共通接頭辞検索(Longest Common Prefix Search)できないため使えません。この演算子は最長共通接頭辞検索を使っています。</p> <p>以下は簡単な使用例です。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>table_create Words TABLE_PAT_KEY|KEY_NORMALIZE ShortText # [[0, 1337566253.89858, 0.000355720520019531], true] load --table Words [ {"_key": "groonga"}, {"_key": "mroonga"}, {"_key": "Senna"}, {"_key": "Tritonn"} ] # [[0, 1337566253.89858, 0.000355720520019531], 4] select Words --filter '_key *T "Groonga is the successor project to Senna."' --output_columns _key # [ # [ # 0, # 1337566253.89858, # 0.000355720520019531 # ], # [ # [ # [ # 2 # ], # [ # [ # "_key", # "ShortText" # ] # ], # [ # "groonga" # ], # [ # "senna" # ] # ] # ] # ] </pre></div> </div> <p>この式は文書 <tt class="docutils literal"><span class="pre">Groonga</span> <span class="pre">is</span> <span class="pre">the</span> <span class="pre">successor</span> <span class="pre">project</span> <span class="pre">to</span> <span class="pre">Senna.</span></tt> に含まれている単語を抽出します。今回は <tt class="docutils literal"><span class="pre">Words</span></tt> に <tt class="docutils literal"><span class="pre">KEY_NORMALIZE</span></tt> フラグが指定されています。そのため、 <tt class="docutils literal"><span class="pre">Words</span></tt> には <tt class="docutils literal"><span class="pre">groonga</span></tt> とロードしていますが <tt class="docutils literal"><span class="pre">Groonga</span></tt> も抽出できています。また、全ての抽出された単語も正規化されています。</p> </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.10.2. スクリプト構文</a><ul> <li><a class="reference internal" href="#sample-data">8.10.2.1. サンプルデータ</a></li> <li><a class="reference internal" href="#literals">8.10.2.2. リテラル</a><ul> <li><a class="reference internal" href="#integer">8.10.2.2.1. 整数</a></li> <li><a class="reference internal" href="#float">8.10.2.2.2. 浮動小数点数</a></li> <li><a class="reference internal" href="#string">8.10.2.2.3. 文字列</a></li> <li><a class="reference internal" href="#boolean">8.10.2.2.4. 真偽値</a></li> <li><a class="reference internal" href="#null">8.10.2.2.5. NULL</a></li> <li><a class="reference internal" href="#time">8.10.2.2.6. 時間</a></li> <li><a class="reference internal" href="#geo-point">8.10.2.2.7. 座標値</a></li> <li><a class="reference internal" href="#array">8.10.2.2.8. 配列</a></li> <li><a class="reference internal" href="#object-literal">8.10.2.2.9. オブジェクトリテラル</a></li> </ul> </li> <li><a class="reference internal" href="#control-syntaxes">8.10.2.3. 制御構文</a></li> <li><a class="reference internal" href="#grouping">8.10.2.4. グループ化</a></li> <li><a class="reference internal" href="#function-call">8.10.2.5. 関数呼び出し</a></li> <li><a class="reference internal" href="#basic-operators">8.10.2.6. 基本的な演算子</a><ul> <li><a class="reference internal" href="#arithmetic-operators">8.10.2.6.1. 算術演算子</a><ul> <li><a class="reference internal" href="#addition-operator">8.10.2.6.1.1. 加算演算子</a></li> <li><a class="reference internal" href="#subtraction-operator">8.10.2.6.1.2. 減算演算子</a></li> <li><a class="reference internal" href="#multiplication-operator">8.10.2.6.1.3. 乗算演算子</a></li> <li><a class="reference internal" href="#division-operator">8.10.2.6.1.4. 除算演算子</a></li> </ul> </li> <li><a class="reference internal" href="#logical-operators">8.10.2.6.2. 論理演算子</a><ul> <li><a class="reference internal" href="#logical-not-operator">8.10.2.6.2.1. 論理否定演算子</a></li> <li><a class="reference internal" href="#logical-and-operator">8.10.2.6.2.2. 論理積演算子</a></li> <li><a class="reference internal" href="#logical-or-operator">8.10.2.6.2.3. 論理和演算子</a></li> <li><a class="reference internal" href="#logical-and-not-operator">8.10.2.6.2.4. 論理差演算子</a></li> </ul> </li> <li><a class="reference internal" href="#bitwise-operators">8.10.2.6.3. ビット演算子</a><ul> <li><a class="reference internal" href="#bitwise-not-operator">8.10.2.6.3.1. ビット否定演算子</a></li> <li><a class="reference internal" href="#bitwise-and-operator">8.10.2.6.3.2. ビット論理積演算子</a></li> </ul> </li> <li><a class="reference internal" href="#bitwise-or-operator">8.10.2.6.4. ビット論理和演算子</a></li> <li><a class="reference internal" href="#bitwise-xor-operator">8.10.2.6.5. ビット排他的論理和演算子</a></li> <li><a class="reference internal" href="#shift-operators">8.10.2.6.6. シフト演算子</a><ul> <li><a class="reference internal" href="#left-shift-operator">8.10.2.6.6.1. 左シフト演算子</a></li> <li><a class="reference internal" href="#signed-right-shift-operator">8.10.2.6.6.2. 符号付き右シフト演算子</a></li> <li><a class="reference internal" href="#unsigned-right-shift-operator">8.10.2.6.6.3. 符号なし右シフト演算子</a></li> </ul> </li> <li><a class="reference internal" href="#comparison-operators">8.10.2.6.7. 比較演算子</a><ul> <li><a class="reference internal" href="#equal-operator">8.10.2.6.7.1. 等価演算子</a></li> <li><a class="reference internal" href="#not-equal-operator">8.10.2.6.7.2. 不等価演算子</a></li> <li><a class="reference internal" href="#less-than-operator">8.10.2.6.7.3. 小なり演算子</a></li> <li><a class="reference internal" href="#less-than-or-equal-to-operator">8.10.2.6.7.4. 以下演算子</a></li> <li><a class="reference internal" href="#greater-than-operator">8.10.2.6.7.5. 大なり演算子</a></li> <li><a class="reference internal" href="#greater-than-or-equal-to-operator">8.10.2.6.7.6. 以上演算子</a></li> </ul> </li> </ul> </li> <li><a class="reference internal" href="#assignment-operators">8.10.2.7. 代入演算子</a><ul> <li><a class="reference internal" href="#addition-assignment-operator">8.10.2.7.1. 加算代入演算子</a></li> <li><a class="reference internal" href="#subtraction-assignment-operator">8.10.2.7.2. 減算代入演算子</a></li> <li><a class="reference internal" href="#multiplication-assignment-operator">8.10.2.7.3. 乗算代入演算子</a></li> <li><a class="reference internal" href="#division-assignment-operator">8.10.2.7.4. 除算代入演算子</a></li> <li><a class="reference internal" href="#modulo-assignment-operator">8.10.2.7.5. 剰余代入演算子</a></li> <li><a class="reference internal" href="#bitwise-left-shift-assignment-operator">8.10.2.7.6. 左シフト代入演算子</a></li> <li><a class="reference internal" href="#bitwise-signed-right-shift-assignment-operator">8.10.2.7.7. 符号あり右シフト代入演算子</a></li> <li><a class="reference internal" href="#bitwise-unsigned-right-shift-assignment-operator">8.10.2.7.8. 符号なし右シフト代入演算子</a></li> <li><a class="reference internal" href="#bitwise-and-assignment-operator">8.10.2.7.9. ビット論理積代入演算子</a></li> <li><a class="reference internal" href="#bitwise-or-assignment-operator">8.10.2.7.10. ビット論理和代入演算子</a></li> <li><a class="reference internal" href="#bitwise-xor-assignment-operator">8.10.2.7.11. ビット排他的論理和代入演算子</a></li> </ul> </li> <li><a class="reference internal" href="#original-operators">8.10.2.8. 独自の演算子</a><ul> <li><a class="reference internal" href="#match-operator">8.10.2.8.1. マッチ演算子</a></li> <li><a class="reference internal" href="#prefix-search-operator">8.10.2.8.2. 前方一致検索演算子</a></li> <li><a class="reference internal" href="#suffix-search-operator">8.10.2.8.3. 後方一致検索演算子</a></li> <li><a class="reference internal" href="#near-search-operator">8.10.2.8.4. 近傍検索演算子</a></li> <li><a class="reference internal" href="#similar-search">8.10.2.8.5. 類似文書検索</a></li> <li><a class="reference internal" href="#term-extract-operator">8.10.2.8.6. 単語抽出演算子</a></li> </ul> </li> </ul> </li> </ul> <h4>前のトピックへ</h4> <p class="topless"><a href="query_syntax.html" title="前の章へ">8.10.1. クエリー構文</a></p> <h4>次のトピックへ</h4> <p class="topless"><a href="../function.html" title="次の章へ">8.11. 関数</a></p> <h3>このページ</h3> <ul class="this-page-menu"> <li><a href="../../_sources/reference/grn_expr/script_syntax.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="../function.html" title="8.11. 関数" >次へ</a> |</li> <li class="right" > <a href="query_syntax.html" title="8.10.1. クエリー構文" >前へ</a> |</li> <li><a href="../../index.html">groonga v3.0.5ドキュメント</a> »</li> <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> <li><a href="../grn_expr.html" >8.10. grn_expr</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009-2013, Brazil, Inc. </div> </body> </html>