Kouhei Sutou
null+****@clear*****
Thu May 18 18:12:39 JST 2017
Kouhei Sutou 2017-05-18 18:12:39 +0900 (Thu, 18 May 2017) New Revision: 19ff870ff7152a333d322a4ff8db02edcfb81e8a https://github.com/pgroonga/pgroonga.github.io/commit/19ff870ff7152a333d322a4ff8db02edcfb81e8a Message: Document &? for jsonb Added files: _po/ja/reference/operators/query-jsonb-v2.po ja/reference/operators/query-jsonb-v2.md reference/operators/query-jsonb-v2.md Copied files: _po/ja/reference/operators/contain-jsonb.po (from _po/ja/reference/operators/jsonb-contain.po) _po/ja/reference/operators/script-jsonb.po (from _po/ja/reference/operators/jsonb-query.po) ja/reference/operators/contain-jsonb.md (from ja/reference/operators/jsonb-contain.md) ja/reference/operators/script-jsonb.md (from ja/reference/operators/jsonb-query.md) Modified files: _po/ja/news/index.po _po/ja/reference/index.po _po/ja/reference/operators/jsonb-contain.po _po/ja/reference/operators/jsonb-query.po ja/news/index.md ja/reference/index.md ja/reference/operators/jsonb-contain.md ja/reference/operators/jsonb-query.md reference/index.md Modified: _po/ja/news/index.po (+15 -4) =================================================================== --- _po/ja/news/index.po 2017-05-09 09:44:01 +0900 (cf48cfe) +++ _po/ja/news/index.po 2017-05-18 18:12:39 +0900 (a51baa3) @@ -20,12 +20,26 @@ msgstr "" msgid "# News" msgstr "# おしらせ" -msgid "## 1.2.0: 2017-04-29 {#version-1-2-0}" +msgid "## 1.2.1: 2017-05-09 {#version-1-2-1}" msgstr "" msgid "### Improvements" msgstr "### 改良" +msgid "" +" * [`pgroonga.text_full_text_search_ops_v2`] Supported `@@` and `%%` for back" +"ward compatibility." +msgstr "" + +msgid "TODO" +msgstr "" + +msgid "### Fixes" +msgstr "### 修正" + +msgid "## 1.2.0: 2017-04-29 {#version-1-2-0}" +msgstr "" + msgid " * [[Windows](../install/windows.html)] Upgraded bundled Groonga to 7.0.2." msgstr "" @@ -91,9 +105,6 @@ msgid "" " operator](../reference/operators/query.html) is deprecated." msgstr "" -msgid "### Fixes" -msgstr "### 修正" - msgid " * [[CentOS](../install/centos.html)] Fixed wrong msgpack library link." msgstr "" Modified: _po/ja/reference/index.po (+187 -46) =================================================================== --- _po/ja/reference/index.po 2017-05-09 09:44:01 +0900 (52327f3) +++ _po/ja/reference/index.po 2017-05-18 18:12:39 +0900 (3c4a758) @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2017-04-28 17:13+0900\n" +"PO-Revision-Date: 2017-05-18 18:10+0900\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -74,45 +74,160 @@ msgstr " * [`jsonb`サポート](jsonb.html)" msgid "## Operators" msgstr "## 演算子" +msgid "### For `text`" +msgstr "" + +msgid "By the default operator class:" +msgstr "" + msgid " * [`LIKE` operator](operators/like.html)" msgstr " * [`LIKE`演算子](operators/like.html)" msgid " * `ILIKE` operator" msgstr " * `ILIKE`演算子" -msgid " * [`&@` operator](operators/match-v2.html)" +msgid " * [`&@` operator](operators/match-v2.html): Full text search by a keyword" msgstr " * [`&@`演算子](operators/match-v2.html)" -msgid " * [`%%` operator](operators/match.html)" -msgstr " * [`%%`演算子](operators/match.html)" +msgid " * [`%%` operator](operators/match.html): Full text search by a keyword" +msgstr " * [`%%`演算子](operators/match.html):キーワード1つでの全文検索" msgid "" " * Deprecated since 1.2.0. Use [`&@` operator](operators/match-v2.html) ins" "tead." msgstr " * 1.2.0から非推奨になりました。代わりに[`&@`演算子](operators/match-v2.html)を使ってください。" -msgid " * [`&?` operator](operators/query-v2.html) for non `jsonb` types" -msgstr " * `jsonb`型以外の型用の[`&?`演算子](operators/query-v2.html)" +msgid "" +" * [`&?` operator](operators/query-v2.html): Full text search by easy to use " +"query language" +msgstr "" -msgid " * [`@@` operator](operators/query.html) for non `jsonb` types" -msgstr " * `jsonb`型以外の型用の[`@@`演算子](operators/query.html)" +msgid "" +" * [`@@` operator](operators/query.html): Full text search by easy to use que" +"ry language" +msgstr "" msgid "" " * Deprecated since 1.2.0. Use [`&?` operator](operators/query-v2.html) ins" "tead." msgstr " * 1.2.0から非推奨になりました。代わりに[`&?`演算子](operators/query-v2.html)を使ってください。" -msgid " * [`@@` operator](operators/jsonb-query.html) for `jsonb` type" -msgstr " * `jsonb`型用の[`@@`演算子](operators/jsonb-query.html)" +msgid "By `pgroonga.text_regexp_ops` operator class:" +msgstr "`pgroonga.text_regexp_ops`演算子クラスが提供:" + +msgid "" +" * [`&~` operator](operators/regular-expression-v2.html): Search by a regular" +" expression" +msgstr "" + +msgid "" +" * [`@~` operator](operators/regular-expression.html): Search by regular a ex" +"pression" +msgstr " * [`@~`演算子](operators/regular-expression.html):正規表現で検索" + +msgid "" +" * Deprecated since 1.2.1. Use [`&~` operator](operators/regular-expression" +"-v2.html) instead." +msgstr "" +" * 1.2.1から非推奨になりました。代わりに[`&~`演算子](operators/regular-expression-v2.html)を使って" +"ください。" + +msgid "### For `text[]`" +msgstr "" + +msgid "" +" * [`&?` operator](operators/query-v2.html): Full text search by easy to use " +"language" +msgstr "" + +msgid "" +" * [`@@` operator](operators/query.html): Full text search by easy to use lan" +"guage" +msgstr "" + +msgid "### For `varchar`" +msgstr "" + +msgid " * `<`" +msgstr "" + +msgid " * `<=`" +msgstr "" + +msgid " * `=`" +msgstr "" -msgid " * [`@>` operator](operators/jsonb-contain.html)" -msgstr " * [`@>`演算子](operators/jsonb-contain.html)" +msgid " * `>=`" +msgstr "" -msgid " * [`@~` operator](operators/regular-expression.html)" -msgstr " * [`@~`演算子](operators/regular-expression.html)" +msgid " * `>`" +msgstr "" -msgid "### v2 operators" -msgstr "### v2演算子" +msgid "By `pgroonga.varchar_full_text_search_ops` operator class:" +msgstr "`pgroonga.varchar_full_text_search_ops`演算子クラスが提供:" + +msgid "By `pgroonga.varchar_regexp_ops` operator class:" +msgstr "" + +msgid "" +" * [`&~` operator](operators/regular-expression-v2.html): Search by regular e" +"xpression" +msgstr "" + +msgid "" +" * [`@~` operator](operators/regular-expression.html): Search by regular expr" +"ession" +msgstr " * [`@~`演算子](operators/regular-expression.html):正規表現で検索" + +msgid "### For `varchar[]`" +msgstr "" + +msgid "" +" * Deprecated since 1.2.1. Use [`&@` operator](operators/match-v2.html) ins" +"tead." +msgstr " * 1.2.1から非推奨になりました。代わりに[`&@`演算子](operators/match-v2.html)を使ってください。" + +msgid "### For boolean, numbers and timestamps" +msgstr "" + +msgid "" +"Supported types: `boolean`, `smallint`, `integer`, `bigint`, `real`, `double p" +"recision`, `timestamp` and `timestamp with time zone`" +msgstr "" + +msgid "### For `jsonb`" +msgstr "" + +msgid "" +" * [`&@` operator][match-jsonb-v2]: Full text search against all text data in" +" `jsonb` by a keyword" +msgstr "" + +msgid "" +" * [`&?` operator][query-jsonb-v2]: Full text search against all text data in" +" `jsonb` by easy to use query language" +msgstr "" + +msgid "" +" * [`` &` `` operator][script-jsonb-v2]: Advanced search by ECMAScript like q" +"uery language" +msgstr "" + +msgid "" +" * [`@@` operator][script-jsonb]: Advanced search by ECMAScript like query la" +"nguage" +msgstr "" + +msgid "" +" * Deprecated since 1.2.1. Use [`` &` `` operator][script-jsonb-v2] instead" +"." +msgstr "" + +msgid " * [`@>` operator][contain-jsonb]: Search by a `jsonb` data" +msgstr "" + +msgid "## Operators v2" +msgstr "## v2演算子" msgid "" "PGroonga 1.Y.Z provides `pgroonga.XXX_v2` operator classes. They don't provide" @@ -129,50 +244,68 @@ msgstr "" "これらを使った場合、PGroongaをアップグレードする場合は[非互換の場合の手順](../upgrade/#incompatible-case)を使う必要" "があります。" -msgid " * `pgroonga.text_full_text_search_ops_v2` operator class" -msgstr " * `pgroonga.text_full_text_search_ops_v2`演算子クラス" +msgid "By `pgroonga.text_full_text_search_ops_v2` operator class:" +msgstr "`pgroonga.text_full_text_search_ops_v2`演算子クラスが提供:" -msgid " * `LIKE` operator" -msgstr " * `LIKE`演算子" +msgid "" +" * Don't use this operator class for newly written code. It's just for back" +"ward compatibility." +msgstr "" -msgid " * `ILIKE` operator" -msgstr " * `ILIKE`演算子" +msgid " * [`&~?` operator](operators/similar-search-v2.html): Similar search" +msgstr " * [`&~?`演算子](operators/similar-search-v2.html):類似文書検索" -msgid " * [`&@` operator](operators/match-v2.html)" -msgstr " * [`&@`演算子](operators/match-v2.html)" +msgid "" +" * [`` &` `` operator](operators/script-v2.html): Advanced search by ECMAScri" +"pt like query language" +msgstr "" + +msgid "" +" * [`&@>` operator](operators/match-contain-v2.html): Full text search by an " +"array of keywords" +msgstr "" + +msgid "" +" * [`&?>` operator](operators/query-contain-v2.html): Full text search by an " +"array of queries in easy to use query language" +msgstr "" -msgid " * [`&?` operator](operators/query-v2.html) for non `jsonb` types" -msgstr " * `jsonb`型以外の型用の[`&?`演算子](operators/query-v2.html)" +msgid "By `pgroonga.text_term_search_ops_v2` operator class:" +msgstr "`pgroonga.text_term_search_ops_v2`演算子クラスが提供:" -msgid " * [`&~?` operator](operators/similar-search-v2.html)" -msgstr " * [`&~?`演算子](operators/similar-search-v2.html)" +msgid " * [`&^` operator](operators/prefix-search-v2.html): Prefix search" +msgstr " * [`&^`演算子](operators/prefix-search-v2.html):前方一致検索" -msgid " * [`` &` `` operator](operators/script-v2.html)" -msgstr " * [`` &` ``演算子](operators/script-v2.html)" +msgid " * [`&^~` operator](operators/prefix-rk-search-v2.html): Prefix RK search" +msgstr " * [`&^~`演算子](operators/prefix-rk-search-v2.html):前方一致RK検索" -msgid " * [`&@>` operator](operators/match-contain-v2.html)" -msgstr " * [`&@>`演算子](operators/match-contain-v2.html)" +msgid "" +" * [`&^>` operator](operators/prefix-search-contain-v2.html): Prefix search b" +"y an array of prefixes" +msgstr "" -msgid " * [`&?>` operator](operators/query-contain-v2.html) for non `jsonb` types" -msgstr " * `jsonb`型以外の型用の[`&?>`演算子](operators/query-contain-v2.html)" +msgid "" +" * [`&^~>` operator](operators/prefix-rk-search-contain-v2.html): Prefix RK s" +"earch by an array of prefixes" +msgstr "" -msgid " * `pgroonga.text_term_search_ops_v2` operator class" -msgstr " * `pgroonga.text_term_search_ops_v2`演算子クラス" +msgid "By `pgroonga.text_regexp_ops_v2` operator class:" +msgstr "`pgroonga.text_regexp_ops_v2`演算子クラスが提供:" -msgid " * [`&^` operator](operators/prefix-search-v2.html)" -msgstr " * [`&^`演算子](operators/prefix-search-v2.html)" +msgid "By `pgroonga.text_array_term_search_ops_v2` operator class" +msgstr "`pgroonga.text_array_term_search_ops_v2`演算子クラスが提供:" -msgid " * [`&^~` operator](operators/prefix-rk-search-v2.html)" -msgstr " * [`&^~`演算子](operators/prefix-rk-search-v2.html)" +msgid "By `pgroonga.varchar_full_text_search_ops_v2` operator class:" +msgstr "`pgroonga.varchar_full_text_search_ops_v2`演算子クラスが提供:" -msgid " * `pgroonga.text_array_term_search_ops_v2` operator class" -msgstr " * `pgroonga.text_array_term_search_ops_v2`演算子クラス" +msgid "By `pgroonga.varchar_regexp_ops_v2` operator class:" +msgstr "" -msgid " * [`&^>` operator](operators/prefix-search-contain-v2.html)" -msgstr " * [`&^>`演算子](operators/prefix-search-contain-v2.html)" +msgid "By `pgroonga.varchar_array_ops_v2` operator class:" +msgstr "" -msgid " * [`&^~>` operator](operators/prefix-rk-search-contain-v2.html)" -msgstr " * [`&^~>`演算子](operators/prefix-rk-search-contain-v2.html)" +msgid "By `pgroonga.jsonb_ops_v2` operator class:" +msgstr "" msgid "## Functions" msgstr "## 関数" @@ -296,3 +429,11 @@ msgstr "" msgid " * [Tuning](http://groonga.org/docs/reference/tuning.html)" msgstr " * [チューニング](http://groonga.org/ja/docs/reference/tuning.html)" + +msgid "" +"[match-jsonb-v2]:operators/match-jsonb-v2.html\n" +"[query-jsonb-v2]:operators/query-jsonb-v2.html\n" +"[script-jsonb-v2]:operators/script-jsonb-v2.html\n" +"[script-jsonb]:operators/script-jsonb.html\n" +"[contain-jsonb]:operators/contain-jsonb.html" +msgstr "" Copied: _po/ja/reference/operators/contain-jsonb.po (+1 -1) 99% =================================================================== --- _po/ja/reference/operators/jsonb-contain.po 2017-05-09 09:44:01 +0900 (f885279) +++ _po/ja/reference/operators/contain-jsonb.po 2017-05-18 18:12:39 +0900 (e7999bd) @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2016-12-05 15:48+0900\n" +"PO-Revision-Date: 2017-04-29 12:39+0900\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" Modified: _po/ja/reference/operators/jsonb-contain.po (+1 -183) =================================================================== --- _po/ja/reference/operators/jsonb-contain.po 2017-05-09 09:44:01 +0900 (f885279) +++ _po/ja/reference/operators/jsonb-contain.po 2017-05-18 18:12:39 +0900 (ea8a07c) @@ -12,188 +12,6 @@ msgid "" "---\n" "title: \"@> operator\"\n" "upper_level: ../\n" +"redirect: contain-jsonb.html\n" "---" msgstr "" -"---\n" -"title: \"@>演算子\"\n" -"upper_level: ../\n" -"---" - -msgid "# `@>` operator" -msgstr "# `@>`演算子" - -msgid "## Summary" -msgstr "## 概要" - -msgid "PGroonga supports fast index search by `@>` operator." -msgstr "PGroongaは`@>`演算子の検索をインデックスを使って高速に実現できます。" - -msgid "" -"[`@>` operator is a built-in PostgreSQL operator]({{ site.postgresql_doc_base_" -"url.en }}/functions-json.html#FUNCTIONS-JSONB-OP-TABLE). `@>` operator returns" -" true when the right hand side `jsonb` type value is a subset of left hand sid" -"e `jsonb` type value." -msgstr "" -"[`@>`演算子はPostgreSQL組み込みの演算子]({{ site.postgresql_doc_base_url.ja }}/functions-j" -"son.html#functions-jsonb-op-table)です。`@>`演算子は右辺の`jsonb`型の値が左辺の`jsonb`型の値のサブセット" -"なら真を返します。" - -msgid "## Syntax" -msgstr "## 構文" - -msgid "Here is the syntax of this operator:" -msgstr "この演算子の構文は次の通りです。" - -msgid "" -"```sql\n" -"jsonb_column @> jsonb_query\n" -"```" -msgstr "" - -msgid "`jsonb_column` is a column that its type is `jsonb`." -msgstr "`jsonb_column`は`jsonb`型のカラムです。" - -msgid "`jsonb_query` is a `jsonb` type value used as query." -msgstr "`jsonb_query`はクエリーとして使う`jsonb`型の値です。" - -msgid "" -"The operator returns `true` when `jsonb_query` is a subset of `jsonb_column` v" -"alue, `false` otherwise." -msgstr "この演算子は`jsonb_query`が`jsonb_column`の値のサブセットなら`true`を返し、そうでない場合は`false`を返します。" - -msgid "## Usage" -msgstr "## 使い方" - -msgid "Here are sample schema and data for examples:" -msgstr "例に使うサンプルスキーマとデータは次の通りです。" - -msgid "" -"```sql\n" -"CREATE TABLE logs (\n" -" record jsonb\n" -");" -msgstr "" - -msgid "CREATE INDEX pgroonga_logs_index ON logs USING pgroonga (record);" -msgstr "" - -msgid "" -"INSERT INTO logs\n" -" VALUES ('{\n" -" \"message\": \"Server is started.\",\n" -" \"host\": \"www.example.com\",\n" -" \"tags\": [\n" -" \"web\",\n" -" \"example.com\"\n" -" ]\n" -" }');\n" -"INSERT INTO logs\n" -" VALUES ('{\n" -" \"message\": \"GET /\",\n" -" \"host\": \"www.example.com\",\n" -" \"code\": 200,\n" -" \"tags\": [\n" -" \"web\",\n" -" \"example.com\"\n" -" ]\n" -" }');\n" -"INSERT INTO logs\n" -" VALUES ('{\n" -" \"message\": \"Send to <info �� example.com>.\",\n" -" \"host\": \"mail.example.net\",\n" -" \"tags\": [\n" -" \"mail\",\n" -" \"example.net\"\n" -" ]\n" -" }');\n" -"```" -msgstr "" - -msgid "Disable sequential scan:" -msgstr "シーケンシャルスキャンを無効にします。" - -msgid "" -"```sql\n" -"SET enable_seqscan = off;\n" -"```" -msgstr "" - -msgid "Here is an example for match case:" -msgstr "マッチする例は次の通りです。" - -msgid "" -"(It uses [`jsonb_pretty()` function]({{ site.postgresql_doc_base_url.en }}/fun" -"ctions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE) provided since PostgreSQL 9." -"5 for readability.)" -msgstr "" -"(読みやすくするためにPostgreSQL 9.5以降で使える[`jsonb_pretty()`関数]({{ site.postgresql_doc_bas" -"e_url.ja }}/functions-json.html#functions-json-processing-table)を使っています。)" - -msgid "" -"```sql\n" -"SELECT jsonb_pretty(record) FROM logs WHERE record @> '{\"host\": \"www.example.c" -"om\"}'::jsonb;\n" -"-- jsonb_pretty \n" -"-- -------------------------------------\n" -"-- { +\n" -"-- \"host\": \"www.example.com\", +\n" -"-- \"tags\": [ +\n" -"-- \"web\", +\n" -"-- \"example.com\" +\n" -"-- ], +\n" -"-- \"message\": \"Server is started.\"+\n" -"-- }\n" -"-- { +\n" -"-- \"code\": 200, +\n" -"-- \"host\": \"www.example.com\", +\n" -"-- \"tags\": [ +\n" -"-- \"web\", +\n" -"-- \"example.com\" +\n" -"-- ], +\n" -"-- \"message\": \"GET /\" +\n" -"-- }\n" -"-- (2 rows)\n" -"```" -msgstr "" - -msgid "Here is an example for not match case." -msgstr "マッチしない例は次の通りです。" - -msgid "" -"If you use an array in the search condition `jsonb` type value, all elements m" -"ust be included in the search target `jsonb` type value. Position of element i" -"sn't cared. If there are one or more elements that are included in the search " -"condition `jsonb` type value but aren't included in the search target `jsonb` " -"type value, record that have the search target `jsonb` type value isn't matche" -"d." -msgstr "" -"検索条件の`jsonb`型の値で配列を使った場合、検索対象の`jsonb`型の値にすべての要素が含まれていなければいけません。要素の順番は問いません。もし、" -"検索条件の`jsonb`型の値の要素のうち、1つでも検索対象の`jsonb`型の値に含まれていない要素があればそのレコードはマッチしません。" - -msgid "" -"In the following example, there are records that have only `\"mail\"` or `\"web\"`" -" but there are no records that have both `\"mail\"` and `\"web\"`. So the followin" -"g `SELECT` returns no record:" -msgstr "" -"以下の例では、`\"mail\"`または`\"web\"`を含むレコードはありますが、`\"mail\"`と`\"web\"`両方を含むレコードはありません。そのため、次の" -"`SELECT`は1つもレコードを返しません。" - -msgid "" -"```sql\n" -"SELECT jsonb_pretty(record) FROM logs WHERE record @> '{\"tags\": [\"mail\", \"web\"" -"]}'::jsonb;\n" -"-- jsonb_pretty \n" -"-- --------------\n" -"-- (0 rows)\n" -"```" -msgstr "" - -msgid "## See also" -msgstr "## 参考" - -msgid "" -" * [`jsonb` support](../jsonb.html)\n" -" * [`@@` operator](jsonb-query.html)" -msgstr "" -" * [`jsonb`サポート](../jsonb.html)\n" -" * [`@@`演算子](jsonb-query.html)" Modified: _po/ja/reference/operators/jsonb-query.po (+1 -392) =================================================================== --- _po/ja/reference/operators/jsonb-query.po 2017-05-09 09:44:01 +0900 (51199d1) +++ _po/ja/reference/operators/jsonb-query.po 2017-05-18 18:12:39 +0900 (a17bb9e) @@ -12,397 +12,6 @@ msgid "" "---\n" "title: \"@@ operator for jsonb type\"\n" "upper_level: ../\n" +"redirect: script-jsonb.html\n" "---" msgstr "" -"---\n" -"title: \"jsonb型用の@@演算子\"\n" -"upper_level: ../\n" -"---" - -msgid "# `@@` operator for `jsonb` type" -msgstr "# `jsonb`型用の`@@`演算子" - -msgid "## Summary" -msgstr "## 概要" - -msgid "" -"`@@` operator is a PGroonga original operator. You can use complex condition t" -"hat can't be written by [`@>` operator](jsonb-contain.html) such as range sear" -"ch." -msgstr "" -"`@@`演算子はPGroonga独自の演算子です。範囲検索のような[`@>`演算子](jsonb-contain.html)では書けないような複雑な条件を書" -"くことができます。" - -msgid "" -"If you know [JsQuery](https://github.com/postgrespro/jsquery), you can underst" -"and like \"PGroonga provides `jsonb` type related search features that are simi" -"lar to JsQuery with different syntax\"." -msgstr "" -"もし[JsQuery](https://github.com/postgrespro/jsquery)を知っているなら、「PGroongaはJsQueryが" -"提供しているような`jsonb`型用の検索機能を違う構文で提供している」と理解してください。" - -msgid "## Syntax" -msgstr "## 構文" - -msgid "Here is the syntax of this operator:" -msgstr "この演算子の構文は次の通りです。" - -msgid "" -"```sql\n" -"jsonb_column @@ condition\n" -"```" -msgstr "" - -msgid "`jsonb_column` is a column that its type is `jsonb`." -msgstr "`jsonb_column`は`jsonb`型のカラムです。" - -msgid "" -"`condition` is a `text` value used as query. It uses [Groonga's script syntax]" -"(http://groonga.org/docs/reference/grn_expr/script_syntax.html)." -msgstr "" -"`condition`はクエリーとして使う`text`型の値です。[Groongaのスクリプト構文](http://groonga.org/ja/docs/" -"reference/grn_expr/script_syntax.html)を使います。" - -msgid "" -"The operator returns `true` when `condition` matches `jsonb_column` value, `fa" -"lse` otherwise." -msgstr "この演算子は`condition`が`jsonb_column`の値にマッチしたら`true`を返し、マッチしなかったら`false`を返します。" - -msgid "## Usage" -msgstr "## 使い方" - -msgid "Here are sample schema and data for examples:" -msgstr "例に使うサンプルスキーマとデータは次の通りです。" - -msgid "" -"```sql\n" -"CREATE TABLE logs (\n" -" record jsonb\n" -");" -msgstr "" - -msgid "CREATE INDEX pgroonga_logs_index ON logs USING pgroonga (record);" -msgstr "" - -msgid "" -"INSERT INTO logs\n" -" VALUES ('{\n" -" \"message\": \"Server is started.\",\n" -" \"host\": \"www.example.com\",\n" -" \"tags\": [\n" -" \"web\",\n" -" \"example.com\"\n" -" ]\n" -" }');\n" -"INSERT INTO logs\n" -" VALUES ('{\n" -" \"message\": \"GET /\",\n" -" \"host\": \"www.example.com\",\n" -" \"code\": 200,\n" -" \"tags\": [\n" -" \"web\",\n" -" \"example.com\"\n" -" ]\n" -" }');\n" -"INSERT INTO logs\n" -" VALUES ('{\n" -" \"message\": \"Send to <info �� example.com>.\",\n" -" \"host\": \"mail.example.net\",\n" -" \"tags\": [\n" -" \"mail\",\n" -" \"example.net\"\n" -" ]\n" -" }');\n" -"```" -msgstr "" - -msgid "Disable sequential scan:" -msgstr "シーケンシャルスキャンを無効にします。" - -msgid "" -"```sql\n" -"SET enable_seqscan = off;\n" -"```" -msgstr "" - -msgid "" -"You need to understand how PGroonga creates index against `jsonb` type value t" -"o create search condition." -msgstr "検索条件を作るためにはPGroongaが`jsonb`型のデータ用のインデックスをどのように作るかを理解する必要があります。" - -msgid "" -"PGroonga splits a `jsonb` type value into values and then creates indexes agai" -"nst these values. In SQL, think about the following schema:" -msgstr "" -"PGroongaは`jsonb`型の値を複数の値に分割し、それらの分割した値に対してインデックスを作成します。SQLで言うと次のスキーマを作っていると考えて" -"ください。" - -msgid "" -"```sql\n" -"CREATE TABLE values (\n" -" key text PRIMARY KEY,\n" -" path text,\n" -" paths text[],\n" -" type text,\n" -" boolean boolean,\n" -" number double precision,\n" -" string text,\n" -" size numeric\n" -");\n" -"```" -msgstr "" - -msgid "Here are descriptions of column:" -msgstr "各カラムの説明は次の通りです。" - -msgid "" -" * `key`: The ID of the value. If value has the same path and content, `key` " -"is the same value. Key format is `'${PATH}|${TYPE}|${VALUE}'`. It's not used i" -"n search condition." -msgstr "" -" * `key`:値のIDです。値が違うパスで違う内容なら`key`は違う値になります。キーのフォーマットは`'${パス}|${種類}|${値}'`です。" -"このカラムは検索条件には使いません。" - -msgid "" -" * `path`: The path of the value from root. It uses [jq](https://stedolan.git" -"hub.io/jq/) compatible format. Object is `[\"${ELEMENT_NAME}\"]`, array is `[]`." -" For example, the path of `\"web\"` in `{\"tags\": [\"web\"]}` is `.[\"tags\"][]`. If " -"you know absolute path of the value, you can use this value in search conditio" -"n." -msgstr "" -" * `path`:値がある位置へのルートからのパスです。[jq](https://stedolan.github.io/jq/)互換のフォーマットです。" -"オブジェクトは`[\"${要素名}\"]`で配列は`[]`です。たとえば、`{\"tags\": [\"web\"]}`の中の`\"web\"`のパスは`.[\"tags\"]" -"[]`です。もし、値の絶対パスを知っているなら検索条件でこの値を使えます。" - -msgid "" -" * `paths`: The paths of the value. It includes absolute path, sub paths, `.$" -"{ELEMENT_NAME1}.${ELEMENT_NAME2}` format paths and paths without array. This c" -"olumn is convenient for search condition because you can use one of them for s" -"earch condition. Here are paths for `\"x\"` in `{\"a\": {\"b\": \"c\": [\"x\"]}}`:" -msgstr "" -" * `paths`: 値を示すパスです。値を示すパスは複数あります。絶対パス、サブパス、`.${要素名1}.${要素名2}`というフォーマットのパス、配" -"列部分を省略したパスがあります。このカラムは検索条件の指定を便利にするために用意されています。検索時にはこの中のパスのどれでも使うことができます。以下はどれ" -"も`{\"a\": {\"b\": \"c\": [\"x\"]}}`の中の`\"x\"`を指定するパスです。" - -msgid "" -" * `.a.b.c`\n" -" * `.[\"a\"][\"b\"][\"c\"]`\n" -" * `.[\"a\"][\"b\"][\"c\"][]`\n" -" * `a.b.c`\n" -" * `[\"a\"][\"b\"][\"c\"]`\n" -" * `[\"a\"][\"b\"][\"c\"][]`\n" -" * `b.c`\n" -" * `[\"b\"][\"c\"]`\n" -" * `[\"b\"][\"c\"][]`\n" -" * `c`\n" -" * `[\"c\"]`\n" -" * `[\"c\"][]`\n" -" * `[]`" -msgstr "" - -msgid " * `type`: The type of the value. This column value is one of them:" -msgstr " * `type`:値の種類です。このカラムの値は次のどれかになります。" - -msgid " * `\"object\"`: Object. No value." -msgstr " * `\"object\"`:オブジェクト。値はありません。" - -msgid " * `\"array\"`: Array. The number of elements is stored in `size` column." -msgstr " * `\"array\"`:配列。`size`カラムに要素数が入っています。" - -msgid " * `\"boolean\"`: Boolean. The value is stored in `boolean` column." -msgstr " * `\"boolean\"`:真偽値。`boolean`カラムに値が入っています。" - -msgid " * `\"number\"`: Number. The value is stored in `number` column." -msgstr " * `\"number\"`:数値。`number`カラムに値が入っています。" - -msgid " * `\"string\"`: String. The value is stored in `string` column." -msgstr " * `\"string\"`:文字列。`string`カラムに値が入っています。" - -msgid "" -" * `boolean`: The value if `type` column value is `\"boolean\"`, `false` otherw" -"ise." -msgstr " * `boolean`:`type`カラムの値が`\"boolean\"`なら値が入っています。それ以外のときは`false`が入っています。" - -msgid " * `number`: The value if `type` column value is `\"number\"`, `0` otherwise." -msgstr " * `number`:`type`カラムの値が`\"number\"`なら値が入っています。それ以外のときは`0`が入っています。" - -msgid " * `string`: The value if `type` column value is `\"string\"`, `\"\"` otherwise." -msgstr " * `string`:`type`カラムの値が`\"string\"`なら値が入っています。それ以外のときは`\"\"`が入っています。" - -msgid "" -" * `size`: The number of elements if `type` column value is `\"array\"`, `0` ot" -"herwise." -msgstr " * `size`:`type`カラムの値が`\"array\"`なら要素数が入っています。それ以外のときは`0`が入っています。" - -msgid "Here is a sample JSON:" -msgstr "以下はサンプルJSONです。" - -msgid "" -"```json\n" -"{\n" -" \"message\": \"GET /\",\n" -" \"host\": \"www.example.com\",\n" -" \"code\": 200,\n" -" \"tags\": [\n" -" \"web\",\n" -" \"example.com\"\n" -" ]\n" -"}\n" -"```" -msgstr "" - -msgid "" -"The JSON is split to the following values. (They are part of all split values." -")" -msgstr "このJSONを次の値に分割します。(これは分割した値の一部です。)" - -msgid "" -"| key | path | paths | type | boolean | number | string | size |\n" -"| --- | ---- | ----- | ---- | ------- | ------ | ------ | ---- |\n" -"| `.|object` | `.` | `[.]` | `object` | | | | |\n" -"| `.[\"message\"]|string|GET /` | `.[\"message\"]` | `[.message, .[\"message\"], mes" -"sage, [\"message\"]]` | `string` | | | `GET /` | |\n" -"| `.[\"tags\"][]|string|web` | `.[\"tags\"]` | `[.tags, .[\"tags\"], .[\"tags\"][], ta" -"gs, [\"tags\"], [\"tags\"][], []]` | `string` | | | `web` | |" -msgstr "" - -msgid "" -"You specify condition that matches split value to `@@` operator. If there is o" -"ne or more split values that match specified condition in `jsonb` type value, " -"the `jsonb` type value is matched." -msgstr "" -"`@@`演算子を使って分割した値にマッチする条件を指定します。もし、`jsonb`型の値の中に条件にマッチする分割した値が1つ以上ある場合はその`jsonb" -"`型の値はマッチしたことになります。" - -msgid "" -"Here is a condition that searches `jsonb` type value that has `www.example.com" -"` string:" -msgstr "次は`www.example.com`という文字列値を含む`jsonb`型の値を検索する条件です。" - -msgid "" -"(It uses [`jsonb_pretty()` function]({{ site.postgresql_doc_base_url.en }}/fun" -"ctions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE) provided since PostgreSQL 9." -"5 for readability.)" -msgstr "" -"(読みやすくするためにPostgreSQL 9.5以降で使える[`jsonb_pretty()`関数]({{ site.postgresql_doc_bas" -"e_url.ja }}/functions-json.html#functions-json-processing-table)を使っています。)" - -msgid "" -"```sql\n" -"SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'string == \"www.example." -"com\"';\n" -"-- jsonb_pretty \n" -"-- -------------------------------------\n" -"-- { +\n" -"-- \"host\": \"www.example.com\", +\n" -"-- \"tags\": [ +\n" -"-- \"web\", +\n" -"-- \"example.com\" +\n" -"-- ], +\n" -"-- \"message\": \"Server is started.\"+\n" -"-- }\n" -"-- { +\n" -"-- \"code\": 200, +\n" -"-- \"host\": \"www.example.com\", +\n" -"-- \"tags\": [ +\n" -"-- \"web\", +\n" -"-- \"example.com\" +\n" -"-- ], +\n" -"-- \"message\": \"GET /\" +\n" -"-- }\n" -"-- (2 rows)\n" -"```" -msgstr "" - -msgid "" -"Here is a condition that searches `jsonb` type value that has number between `" -"200` to `299` as `code` column value. The condition uses `paths @ \"...\"` synta" -"x to use simple path format (`.code`) to specify path." -msgstr "" -"以下は`code`カラムの値として`200`から`299`の間の数値を持っている`jsonb`型の値を検索する条件です。この条件はパスの指定に簡易パスフォー" -"マット(`.code`)を使うため、`paths @ \"...\"`という構文を使っています。" - -msgid "" -"```sql\n" -"SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'paths @ \".code\" && numb" -"er >= 200 && number < 300';\n" -"-- jsonb_pretty \n" -"-- --------------------------------\n" -"-- { +\n" -"-- \"code\": 200, +\n" -"-- \"host\": \"www.example.com\",+\n" -"-- \"tags\": [ +\n" -"-- \"web\", +\n" -"-- \"example.com\" +\n" -"-- ], +\n" -"-- \"message\": \"GET /\" +\n" -"-- }\n" -"-- (1 row)\n" -"```" -msgstr "" - -msgid "" -"Here is a condition for full text search from all text values in `jsonb` value" -" type:" -msgstr "`jsonb`型の値の中のすべてのテキスト値に対して全文検索をする条件は次の通りです。" - -msgid "" -"```sql\n" -"SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'string @ \"started\"';\n" -"-- jsonb_pretty \n" -"-- -------------------------------------\n" -"-- { +\n" -"-- \"host\": \"www.example.com\", +\n" -"-- \"tags\": [ +\n" -"-- \"web\", +\n" -"-- \"example.com\" +\n" -"-- ], +\n" -"-- \"message\": \"Server is started.\"+\n" -"-- }\n" -"-- (1 row)\n" -"```" -msgstr "" - -msgid "" -"You can use [Groonga's query syntax](http://groonga.org/docs/reference/grn_exp" -"r/query_syntax.html) (`a OR b` can be used) for full text search by `query(\"st" -"ring\", \"...\")` syntax:" -msgstr "" -"全文検索用に[Groongaのクエリー構文](http://groonga.org/ja/docs/reference/grn_expr/query_syn" -"tax.html)(`a OR b`という構文を使えます)を使うには`query(\"string\", \"...\")`という構文を使います。" - -msgid "" -"```sql\n" -"SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'query(\"string\", \"send O" -"R server\")';\n" -"-- jsonb_pretty \n" -"-- ----------------------------------------------\n" -"-- { +\n" -"-- \"host\": \"www.example.com\", +\n" -"-- \"tags\": [ +\n" -"-- \"web\", +\n" -"-- \"example.com\" +\n" -"-- ], +\n" -"-- \"message\": \"Server is started.\" +\n" -"-- }\n" -"-- { +\n" -"-- \"host\": \"mail.example.net\", +\n" -"-- \"tags\": [ +\n" -"-- \"mail\", +\n" -"-- \"example.net\" +\n" -"-- ], +\n" -"-- \"message\": \"Send to <info �� example.com>.\"+\n" -"-- }\n" -"-- (2 rows)\n" -"```" -msgstr "" - -msgid "## See also" -msgstr "## 参考" - -msgid "" -" * [`jsonb` support](../jsonb.html)\n" -" * [`@>` operator](jsonb-contain.html)" -msgstr "" -" * [`jsonb`サポート](../jsonb.html)\n" -" * [`@>`演算子](jsonb-contain.html)" Added: _po/ja/reference/operators/query-jsonb-v2.po (+167 -0) 100644 =================================================================== --- /dev/null +++ _po/ja/reference/operators/query-jsonb-v2.po 2017-05-18 18:12:39 +0900 (4301ce4) @@ -0,0 +1,167 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2017-05-18 18:10+0900\n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "" +"---\n" +"title: \"&? operator for jsonb type\"\n" +"upper_level: ../\n" +"---" +msgstr "" + +msgid "# `$?` operator for `jsonb` type" +msgstr "" + +msgid "## Summary" +msgstr "## 概要" + +msgid "" +"`$?` operator performs full text search against all texts in `jsonb` with quer" +"y." +msgstr "" + +msgid "" +"Query's syntax is similar to syntax that is used in Web search engine. For exa" +"mple, you can use OR search by `KEYWORD1 OR KEYWORD2` in query." +msgstr "クエリーの構文はWeb検索エンジンで使われている構文と似ています。たとえば、クエリーで`キーワード1 OR キーワード2`と書くとOR検索できます。" + +msgid "## Syntax" +msgstr "## 構文" + +msgid "" +"```sql\n" +"column &? query\n" +"```" +msgstr "" + +msgid "`column` is a column to be searched. It's `jsonb` type." +msgstr "" + +msgid "`query` is a query for full text search. It's `text` type." +msgstr "`query`は全文検索で使うクエリーです。`text`型です。" + +msgid "" +"[Groonga's query syntax](http://groonga.org/docs/reference/grn_expr/query_synt" +"ax.html) is used in `query`." +msgstr "" +"`query`では[Groongaのクエリー構文](http://groonga.org/ja/docs/reference/grn_expr/query_" +"syntax.html)を使います。" + +msgid "## Usage" +msgstr "## 使い方" + +msgid "Here are sample schema and data for examples:" +msgstr "例に使うサンプルスキーマとデータは次の通りです。" + +msgid "" +"```sql\n" +"CREATE TABLE logs (\n" +" record jsonb\n" +");" +msgstr "" + +msgid "CREATE INDEX pgroonga_logs_index ON logs USING pgroonga (record);" +msgstr "" + +msgid "" +"INSERT INTO logs\n" +" VALUES ('{\n" +" \"message\": \"Server is started.\",\n" +" \"host\": \"www.example.com\",\n" +" \"tags\": [\n" +" \"web\",\n" +" \"example.com\"\n" +" ]\n" +" }');\n" +"INSERT INTO logs\n" +" VALUES ('{\n" +" \"message\": \"GET /\",\n" +" \"host\": \"www.example.com\",\n" +" \"code\": 200,\n" +" \"tags\": [\n" +" \"web\",\n" +" \"example.com\"\n" +" ]\n" +" }');\n" +"INSERT INTO logs\n" +" VALUES ('{\n" +" \"message\": \"Send to <info �� example.com>.\",\n" +" \"host\": \"mail.example.net\",\n" +" \"tags\": [\n" +" \"mail\",\n" +" \"example.net\"\n" +" ]\n" +" }');\n" +"```" +msgstr "" + +msgid "" +"You can perform full text search with multiple keywords by `&?` operator like " +"`KEYWORD1 KEYWORD2`. You can also do OR search by `KEYWORD1 OR KEYWORD2`:" +msgstr "" +"`@?`演算子を使うと`キーワード1 キーワード2`のように複数のキーワードを指定して全文検索できます。`キーワード1 OR キーワード2`のようにOR検索" +"することもできます。" + +msgid "" +"(It uses [`jsonb_pretty()` function]({{ site.postgresql_doc_base_url.en }}/fun" +"ctions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE) provided since PostgreSQL 9." +"5 for readability.)" +msgstr "" +"(読みやすくするためにPostgreSQL 9.5以降で使える[`jsonb_pretty()`関数]({{ site.postgresql_doc_bas" +"e_url.ja }}/functions-json.html#functions-json-processing-table)を使っています。)" + +msgid "" +"```sql\n" +"SELECT jsonb_pretty(record) FROM logs WHERE record &? 'server OR mail';\n" +"-- jsonb_pretty \n" +"-- ----------------------------------------------\n" +"-- { +\n" +"-- \"host\": \"www.example.com\", +\n" +"-- \"tags\": [ +\n" +"-- \"web\", +\n" +"-- \"example.com\" +\n" +"-- ], +\n" +"-- \"message\": \"Server is started.\" +\n" +"-- }\n" +"-- { +\n" +"-- \"host\": \"mail.example.net\", +\n" +"-- \"tags\": [ +\n" +"-- \"mail\", +\n" +"-- \"example.net\" +\n" +"-- ], +\n" +"-- \"message\": \"Send to <info �� example.com>.\"+\n" +"-- }\n" +"-- (2 rows)\n" +"```" +msgstr "" + +msgid "## See also" +msgstr "## 参考" + +msgid " * [`jsonb` support](../jsonb.html)" +msgstr "" + +msgid "" +" * [`&@` operator][match-jsonb-v2]: Full text search against all text data in" +" `jsonb` by a keyword" +msgstr "" + +msgid "" +" * [`` &` `` operator][script-jsonb-v2]: Advanced search by ECMAScript like q" +"uery language" +msgstr "" + +msgid " * [`@>` operator][contain-jsonb]: Search by a `jsonb` data" +msgstr "" + +msgid "" +"[match-jsonb-v2]:match-jsonb-v2.html\n" +"[script-jsonb-v2]:script-jsonb-v2.html\n" +"[contain-jsonb]:contain-jsonb.html" +msgstr "" Copied: _po/ja/reference/operators/script-jsonb.po (+1 -1) 99% =================================================================== --- _po/ja/reference/operators/jsonb-query.po 2017-05-09 09:44:01 +0900 (51199d1) +++ _po/ja/reference/operators/script-jsonb.po 2017-05-18 18:12:39 +0900 (5a2343c) @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2016-12-05 15:48+0900\n" +"PO-Revision-Date: 2017-04-29 12:39+0900\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" Modified: ja/news/index.md (+12 -0) =================================================================== --- ja/news/index.md 2017-05-09 09:44:01 +0900 (11e00ba) +++ ja/news/index.md 2017-05-18 18:12:39 +0900 (c392155) @@ -4,6 +4,18 @@ title: おしらせ # おしらせ +## 1.2.1: 2017-05-09 {#version-1-2-1} + +### 改良 + + * [`pgroonga.text_full_text_search_ops_v2`] Supported `@@` and `%%` for backward compatibility. + +TODO + +### 修正 + +TODO + ## 1.2.0: 2017-04-29 {#version-1-2-0} ### 改良 Modified: ja/reference/index.md (+236 -22) =================================================================== --- ja/reference/index.md 2017-05-09 09:44:01 +0900 (94cdd4a) +++ ja/reference/index.md 2017-05-18 18:12:39 +0900 (f8e18ca) @@ -28,63 +28,271 @@ PGroongaは`pgroonga`スキーマに関数・演算子・演算子クラスな ## 演算子 +### For `text` + +By the default operator class: + * [`LIKE`演算子](operators/like.html) * `ILIKE`演算子 * [`&@`演算子](operators/match-v2.html) - * [`%%`演算子](operators/match.html) + * [`%%`演算子](operators/match.html):キーワード1つでの全文検索 * 1.2.0から非推奨になりました。代わりに[`&@`演算子](operators/match-v2.html)を使ってください。 - * `jsonb`型以外の型用の[`&?`演算子](operators/query-v2.html) + * [`&?` operator](operators/query-v2.html): Full text search by easy to use query language - * `jsonb`型以外の型用の[`@@`演算子](operators/query.html) + * [`@@` operator](operators/query.html): Full text search by easy to use query language * 1.2.0から非推奨になりました。代わりに[`&?`演算子](operators/query-v2.html)を使ってください。 - * `jsonb`型用の[`@@`演算子](operators/jsonb-query.html) +`pgroonga.text_regexp_ops`演算子クラスが提供: + + * [`LIKE`演算子](operators/like.html) + + * `ILIKE`演算子 + + * [`&~` operator](operators/regular-expression-v2.html): Search by a regular expression + + * [`@~`演算子](operators/regular-expression.html):正規表現で検索 + + * 1.2.1から非推奨になりました。代わりに[`&~`演算子](operators/regular-expression-v2.html)を使ってください。 + +### For `text[]` + + * [`&@`演算子](operators/match-v2.html) + + * [`%%`演算子](operators/match.html):キーワード1つでの全文検索 + + * 1.2.0から非推奨になりました。代わりに[`&@`演算子](operators/match-v2.html)を使ってください。 + + * [`&?` operator](operators/query-v2.html): Full text search by easy to use language - * [`@>`演算子](operators/jsonb-contain.html) + * [`@@` operator](operators/query.html): Full text search by easy to use language + + * 1.2.0から非推奨になりました。代わりに[`&?`演算子](operators/query-v2.html)を使ってください。 + +### For `varchar` + +By the default operator class: + + * `<` + + * `<=` + + * `=` + + * `>=` + + * `>` + +`pgroonga.varchar_full_text_search_ops`演算子クラスが提供: + + * [`&@`演算子](operators/match-v2.html) + + * [`%%`演算子](operators/match.html):キーワード1つでの全文検索 + + * 1.2.0から非推奨になりました。代わりに[`&@`演算子](operators/match-v2.html)を使ってください。 - * [`@~`演算子](operators/regular-expression.html) + * [`&?` operator](operators/query-v2.html): Full text search by easy to use language -### v2演算子 + * [`@@` operator](operators/query.html): Full text search by easy to use language + + * 1.2.0から非推奨になりました。代わりに[`&?`演算子](operators/query-v2.html)を使ってください。 + +By `pgroonga.varchar_regexp_ops` operator class: + + * [`&~` operator](operators/regular-expression-v2.html): Search by regular expression + + * [`@~`演算子](operators/regular-expression.html):正規表現で検索 + + * 1.2.1から非推奨になりました。代わりに[`&~`演算子](operators/regular-expression-v2.html)を使ってください。 + +### For `varchar[]` + + * [`&@`演算子](operators/match-v2.html) + + * [`%%`演算子](operators/match.html):キーワード1つでの全文検索 + + * 1.2.1から非推奨になりました。代わりに[`&@`演算子](operators/match-v2.html)を使ってください。 + +### For boolean, numbers and timestamps + +Supported types: `boolean`, `smallint`, `integer`, `bigint`, `real`, `double precision`, `timestamp` and `timestamp with time zone` + + * `<` + + * `<=` + + * `=` + + * `>=` + + * `>` + +### For `jsonb` + + * [`&@` operator][match-jsonb-v2]: Full text search against all text data in `jsonb` by a keyword + + * [`&?` operator][query-jsonb-v2]: Full text search against all text data in `jsonb` by easy to use query language + + * [`` &` `` operator][script-jsonb-v2]: Advanced search by ECMAScript like query language + + * [`@@` operator][script-jsonb]: Advanced search by ECMAScript like query language + + * Deprecated since 1.2.1. Use [`` &` `` operator][script-jsonb-v2] instead. + + * [`@>` operator][contain-jsonb]: Search by a `jsonb` data + +## v2演算子 PGroonga 1.Y.Zは`pgroonga.XXX_v2`という演算子クラスを提供します。これらはPGroonga 2.0.0になるまで後方互換性を提供しません。しかし、これらの演算子クラスには新しいバージョンがリリースされるごとに積極的に多くの改良が入ります。 これらを使った場合、PGroongaをアップグレードする場合は[非互換の場合の手順](../upgrade/#incompatible-case)を使う必要があります。 - * `pgroonga.text_full_text_search_ops_v2`演算子クラス +### For `text` + +`pgroonga.text_full_text_search_ops_v2`演算子クラスが提供: + + * [`LIKE`演算子](operators/like.html) + + * `ILIKE`演算子 + + * [`&@`演算子](operators/match-v2.html) + + * [`%%`演算子](operators/match.html):キーワード1つでの全文検索 + + * Don't use this operator class for newly written code. It's just for backward compatibility. + + * [`&?` operator](operators/query-v2.html): Full text search by easy to use query language + + * [`@@` operator](operators/query.html): Full text search by easy to use query language + + * Don't use this operator class for newly written code. It's just for backward compatibility. + + * [`&~?`演算子](operators/similar-search-v2.html):類似文書検索 + + * [`` &` `` operator](operators/script-v2.html): Advanced search by ECMAScript like query language + + * [`&@>` operator](operators/match-contain-v2.html): Full text search by an array of keywords + + * [`&?>` operator](operators/query-contain-v2.html): Full text search by an array of queries in easy to use query language + +`pgroonga.text_term_search_ops_v2`演算子クラスが提供: + + * [`&^`演算子](operators/prefix-search-v2.html):前方一致検索 + + * [`&^~`演算子](operators/prefix-rk-search-v2.html):前方一致RK検索 + + * [`&^>` operator](operators/prefix-search-contain-v2.html): Prefix search by an array of prefixes + + * [`&^~>` operator](operators/prefix-rk-search-contain-v2.html): Prefix RK search by an array of prefixes + +`pgroonga.text_regexp_ops_v2`演算子クラスが提供: + + * [`LIKE`演算子](operators/like.html) + + * `ILIKE`演算子 + + * [`&~` operator](operators/regular-expression-v2.html): Search by regular expression + + * [`@~`演算子](operators/regular-expression.html):正規表現で検索 + + * Don't use this operator class for newly written code. It's just for backward compatibility. + +### For `text[]` + +`pgroonga.text_full_text_search_ops_v2`演算子クラスが提供: + + * [`&@`演算子](operators/match-v2.html) + + * [`%%`演算子](operators/match.html):キーワード1つでの全文検索 + + * Don't use this operator class for newly written code. It's just for backward compatibility. - * `LIKE`演算子 + * [`&?` operator](operators/query-v2.html): Full text search by easy to use language - * `ILIKE`演算子 + * [`@@` operator](operators/query.html): Full text search by easy to use language - * [`&@`演算子](operators/match-v2.html) + * Don't use this operator class for newly written code. It's just for backward compatibility. - * `jsonb`型以外の型用の[`&?`演算子](operators/query-v2.html) + * [`&~?`演算子](operators/similar-search-v2.html):類似文書検索 - * [`&~?`演算子](operators/similar-search-v2.html) + * [`` &` `` operator](operators/script-v2.html): Advanced search by ECMAScript like query language - * [`` &` ``演算子](operators/script-v2.html) + * [`&@>` operator](operators/match-contain-v2.html): Full text search by an array of keywords - * [`&@>`演算子](operators/match-contain-v2.html) + * [`&?>` operator](operators/query-contain-v2.html): Full text search by an array of queries in easy to use query language - * `jsonb`型以外の型用の[`&?>`演算子](operators/query-contain-v2.html) +`pgroonga.text_array_term_search_ops_v2`演算子クラスが提供: - * `pgroonga.text_term_search_ops_v2`演算子クラス + * [`&^`演算子](operators/prefix-search-v2.html):前方一致検索 - * [`&^`演算子](operators/prefix-search-v2.html) + * [`&^~`演算子](operators/prefix-rk-search-v2.html):前方一致RK検索 - * [`&^~`演算子](operators/prefix-rk-search-v2.html) + * [`&^>` operator](operators/prefix-search-contain-v2.html): Prefix search by an array of prefixes - * `pgroonga.text_array_term_search_ops_v2`演算子クラス + * [`&^~>` operator](operators/prefix-rk-search-contain-v2.html): Prefix RK search by an array of prefixes - * [`&^>`演算子](operators/prefix-search-contain-v2.html) +### For `varchar` - * [`&^~>`演算子](operators/prefix-rk-search-contain-v2.html) +`pgroonga.varchar_full_text_search_ops_v2`演算子クラスが提供: + + * [`&@`演算子](operators/match-v2.html) + + * [`%%`演算子](operators/match.html):キーワード1つでの全文検索 + + * Don't use this operator class for newly written code. It's just for backward compatibility. + + * [`&?` operator](operators/query-v2.html): Full text search by easy to use query language + + * [`@@` operator](operators/query.html): Full text search by easy to use query language + + * Don't use this operator class for newly written code. It's just for backward compatibility. + + * [`&~?`演算子](operators/similar-search-v2.html):類似文書検索 + + * [`` &` `` operator](operators/script-v2.html): Advanced search by ECMAScript like query language + + * [`&@>` operator](operators/match-contain-v2.html): Full text search by an array of keywords + + * [`&?>` operator](operators/query-contain-v2.html): Full text search by an array of queries in easy to use query language + +By `pgroonga.varchar_regexp_ops_v2` operator class: + + * [`&~` operator](operators/regular-expression-v2.html): Search by regular expression + + * [`@~`演算子](operators/regular-expression.html):正規表現で検索 + + * Don't use this operator class for newly written code. It's just for backward compatibility. + +### For `varchar[]` + +By `pgroonga.varchar_array_ops_v2` operator class: + + * [`&@`演算子](operators/match-v2.html) + + * [`%%`演算子](operators/match.html):キーワード1つでの全文検索 + + * Don't use this operator class for newly written code. It's just for backward compatibility. + +### For `jsonb` + +By `pgroonga.jsonb_ops_v2` operator class: + + * [`&@` operator][match-jsonb-v2]: Full text search against all text data in `jsonb` by a keyword + + * [`&?` operator][query-jsonb-v2]: Full text search against all text data in `jsonb` by easy to use query language + + * [`` &` `` operator][script-jsonb-v2]: Advanced search by ECMAScript like query language + + * [`@@` operator][script-jsonb]: Advanced search by ECMAScript like query language + + * Don't use this operator class for newly written code. It's just for backward compatibility. + + * [`@>` operator][contain-jsonb]: Search by a `jsonb` data ## 関数 @@ -144,3 +352,9 @@ PGroonga 1.Y.Zは`pgroonga.XXX_v2`という演算子クラスを提供します しかし、非常に大きなデータベースを扱うなどいくつかのケースではPGroongaをチューニングする必要があります。PGroongaはバックエンドとしてGroongaを使っています。つまり、Groonga用のチューニング知識をPGroongaでも使えるということです。PGroongaをチューニングする場合は以下のGroongaのドキュメントを参照してください。 * [チューニング](http://groonga.org/ja/docs/reference/tuning.html) + +[match-jsonb-v2]:operators/match-jsonb-v2.html +[query-jsonb-v2]:operators/query-jsonb-v2.html +[script-jsonb-v2]:operators/script-jsonb-v2.html +[script-jsonb]:operators/script-jsonb.html +[contain-jsonb]:operators/contain-jsonb.html Copied: ja/reference/operators/contain-jsonb.md (+0 -0) 100% =================================================================== Modified: ja/reference/operators/jsonb-contain.md (+2 -116) =================================================================== --- ja/reference/operators/jsonb-contain.md 2017-05-09 09:44:01 +0900 (b11952e) +++ ja/reference/operators/jsonb-contain.md 2017-05-18 18:12:39 +0900 (05d3e2d) @@ -1,119 +1,5 @@ --- -title: "@>演算子" +title: "@> operator" upper_level: ../ +redirect: contain-jsonb.html --- - -# `@>`演算子 - -## 概要 - -PGroongaは`@>`演算子の検索をインデックスを使って高速に実現できます。 - -[`@>`演算子はPostgreSQL組み込みの演算子]({{ site.postgresql_doc_base_url.ja }}/functions-json.html#functions-jsonb-op-table)です。`@>`演算子は右辺の`jsonb`型の値が左辺の`jsonb`型の値のサブセットなら真を返します。 - -## 構文 - -この演算子の構文は次の通りです。 - -```sql -jsonb_column @> jsonb_query -``` - -`jsonb_column`は`jsonb`型のカラムです。 - -`jsonb_query`はクエリーとして使う`jsonb`型の値です。 - -この演算子は`jsonb_query`が`jsonb_column`の値のサブセットなら`true`を返し、そうでない場合は`false`を返します。 - -## 使い方 - -例に使うサンプルスキーマとデータは次の通りです。 - -```sql -CREATE TABLE logs ( - record jsonb -); - -CREATE INDEX pgroonga_logs_index ON logs USING pgroonga (record); - -INSERT INTO logs - VALUES ('{ - "message": "Server is started.", - "host": "www.example.com", - "tags": [ - "web", - "example.com" - ] - }'); -INSERT INTO logs - VALUES ('{ - "message": "GET /", - "host": "www.example.com", - "code": 200, - "tags": [ - "web", - "example.com" - ] - }'); -INSERT INTO logs - VALUES ('{ - "message": "Send to <info �� example.com>.", - "host": "mail.example.net", - "tags": [ - "mail", - "example.net" - ] - }'); -``` - -シーケンシャルスキャンを無効にします。 - -```sql -SET enable_seqscan = off; -``` - -マッチする例は次の通りです。 - -(読みやすくするためにPostgreSQL 9.5以降で使える[`jsonb_pretty()`関数]({{ site.postgresql_doc_base_url.ja }}/functions-json.html#functions-json-processing-table)を使っています。) - -```sql -SELECT jsonb_pretty(record) FROM logs WHERE record @> '{"host": "www.example.com"}'::jsonb; --- jsonb_pretty --- ------------------------------------- --- { + --- "host": "www.example.com", + --- "tags": [ + --- "web", + --- "example.com" + --- ], + --- "message": "Server is started."+ --- } --- { + --- "code": 200, + --- "host": "www.example.com", + --- "tags": [ + --- "web", + --- "example.com" + --- ], + --- "message": "GET /" + --- } --- (2 rows) -``` - -マッチしない例は次の通りです。 - -検索条件の`jsonb`型の値で配列を使った場合、検索対象の`jsonb`型の値にすべての要素が含まれていなければいけません。要素の順番は問いません。もし、検索条件の`jsonb`型の値の要素のうち、1つでも検索対象の`jsonb`型の値に含まれていない要素があればそのレコードはマッチしません。 - -以下の例では、`"mail"`または`"web"`を含むレコードはありますが、`"mail"`と`"web"`両方を含むレコードはありません。そのため、次の`SELECT`は1つもレコードを返しません。 - -```sql -SELECT jsonb_pretty(record) FROM logs WHERE record @> '{"tags": ["mail", "web"]}'::jsonb; --- jsonb_pretty --- -------------- --- (0 rows) -``` - -## 参考 - - * [`jsonb`サポート](../jsonb.html) - * [`@@`演算子](jsonb-query.html) Modified: ja/reference/operators/jsonb-query.md (+2 -246) =================================================================== --- ja/reference/operators/jsonb-query.md 2017-05-09 09:44:01 +0900 (5474f37) +++ ja/reference/operators/jsonb-query.md 2017-05-18 18:12:39 +0900 (054ed3a) @@ -1,249 +1,5 @@ --- -title: "jsonb型用の@@演算子" +title: "@@ operator for jsonb type" upper_level: ../ +redirect: script-jsonb.html --- - -# `jsonb`型用の`@@`演算子 - -## 概要 - -`@@`演算子はPGroonga独自の演算子です。範囲検索のような[`@>`演算子](jsonb-contain.html)では書けないような複雑な条件を書くことができます。 - -もし[JsQuery](https://github.com/postgrespro/jsquery)を知っているなら、「PGroongaはJsQueryが提供しているような`jsonb`型用の検索機能を違う構文で提供している」と理解してください。 - -## 構文 - -この演算子の構文は次の通りです。 - -```sql -jsonb_column @@ condition -``` - -`jsonb_column`は`jsonb`型のカラムです。 - -`condition`はクエリーとして使う`text`型の値です。[Groongaのスクリプト構文](http://groonga.org/ja/docs/reference/grn_expr/script_syntax.html)を使います。 - -この演算子は`condition`が`jsonb_column`の値にマッチしたら`true`を返し、マッチしなかったら`false`を返します。 - -## 使い方 - -例に使うサンプルスキーマとデータは次の通りです。 - -```sql -CREATE TABLE logs ( - record jsonb -); - -CREATE INDEX pgroonga_logs_index ON logs USING pgroonga (record); - -INSERT INTO logs - VALUES ('{ - "message": "Server is started.", - "host": "www.example.com", - "tags": [ - "web", - "example.com" - ] - }'); -INSERT INTO logs - VALUES ('{ - "message": "GET /", - "host": "www.example.com", - "code": 200, - "tags": [ - "web", - "example.com" - ] - }'); -INSERT INTO logs - VALUES ('{ - "message": "Send to <info �� example.com>.", - "host": "mail.example.net", - "tags": [ - "mail", - "example.net" - ] - }'); -``` - -シーケンシャルスキャンを無効にします。 - -```sql -SET enable_seqscan = off; -``` - -検索条件を作るためにはPGroongaが`jsonb`型のデータ用のインデックスをどのように作るかを理解する必要があります。 - -PGroongaは`jsonb`型の値を複数の値に分割し、それらの分割した値に対してインデックスを作成します。SQLで言うと次のスキーマを作っていると考えてください。 - -```sql -CREATE TABLE values ( - key text PRIMARY KEY, - path text, - paths text[], - type text, - boolean boolean, - number double precision, - string text, - size numeric -); -``` - -各カラムの説明は次の通りです。 - - * `key`:値のIDです。値が違うパスで違う内容なら`key`は違う値になります。キーのフォーマットは`'${パス}|${種類}|${値}'`です。このカラムは検索条件には使いません。 - - * `path`:値がある位置へのルートからのパスです。[jq](https://stedolan.github.io/jq/)互換のフォーマットです。オブジェクトは`["${要素名}"]`で配列は`[]`です。たとえば、`{"tags": ["web"]}`の中の`"web"`のパスは`.["tags"][]`です。もし、値の絶対パスを知っているなら検索条件でこの値を使えます。 - - * `paths`: 値を示すパスです。値を示すパスは複数あります。絶対パス、サブパス、`.${要素名1}.${要素名2}`というフォーマットのパス、配列部分を省略したパスがあります。このカラムは検索条件の指定を便利にするために用意されています。検索時にはこの中のパスのどれでも使うことができます。以下はどれも`{"a": {"b": "c": ["x"]}}`の中の`"x"`を指定するパスです。 - - * `.a.b.c` - * `.["a"]["b"]["c"]` - * `.["a"]["b"]["c"][]` - * `a.b.c` - * `["a"]["b"]["c"]` - * `["a"]["b"]["c"][]` - * `b.c` - * `["b"]["c"]` - * `["b"]["c"][]` - * `c` - * `["c"]` - * `["c"][]` - * `[]` - - * `type`:値の種類です。このカラムの値は次のどれかになります。 - - * `"object"`:オブジェクト。値はありません。 - - * `"array"`:配列。`size`カラムに要素数が入っています。 - - * `"boolean"`:真偽値。`boolean`カラムに値が入っています。 - - * `"number"`:数値。`number`カラムに値が入っています。 - - * `"string"`:文字列。`string`カラムに値が入っています。 - - * `boolean`:`type`カラムの値が`"boolean"`なら値が入っています。それ以外のときは`false`が入っています。 - - * `number`:`type`カラムの値が`"number"`なら値が入っています。それ以外のときは`0`が入っています。 - - * `string`:`type`カラムの値が`"string"`なら値が入っています。それ以外のときは`""`が入っています。 - - * `size`:`type`カラムの値が`"array"`なら要素数が入っています。それ以外のときは`0`が入っています。 - -以下はサンプルJSONです。 - -```json -{ - "message": "GET /", - "host": "www.example.com", - "code": 200, - "tags": [ - "web", - "example.com" - ] -} -``` - -このJSONを次の値に分割します。(これは分割した値の一部です。) - -| key | path | paths | type | boolean | number | string | size | -| --- | ---- | ----- | ---- | ------- | ------ | ------ | ---- | -| `.|object` | `.` | `[.]` | `object` | | | | | -| `.["message"]|string|GET /` | `.["message"]` | `[.message, .["message"], message, ["message"]]` | `string` | | | `GET /` | | -| `.["tags"][]|string|web` | `.["tags"]` | `[.tags, .["tags"], .["tags"][], tags, ["tags"], ["tags"][], []]` | `string` | | | `web` | | - -`@@`演算子を使って分割した値にマッチする条件を指定します。もし、`jsonb`型の値の中に条件にマッチする分割した値が1つ以上ある場合はその`jsonb`型の値はマッチしたことになります。 - -次は`www.example.com`という文字列値を含む`jsonb`型の値を検索する条件です。 - -(読みやすくするためにPostgreSQL 9.5以降で使える[`jsonb_pretty()`関数]({{ site.postgresql_doc_base_url.ja }}/functions-json.html#functions-json-processing-table)を使っています。) - -```sql -SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'string == "www.example.com"'; --- jsonb_pretty --- ------------------------------------- --- { + --- "host": "www.example.com", + --- "tags": [ + --- "web", + --- "example.com" + --- ], + --- "message": "Server is started."+ --- } --- { + --- "code": 200, + --- "host": "www.example.com", + --- "tags": [ + --- "web", + --- "example.com" + --- ], + --- "message": "GET /" + --- } --- (2 rows) -``` - -以下は`code`カラムの値として`200`から`299`の間の数値を持っている`jsonb`型の値を検索する条件です。この条件はパスの指定に簡易パスフォーマット(`.code`)を使うため、`paths @ "..."`という構文を使っています。 - -```sql -SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'paths @ ".code" && number >= 200 && number < 300'; --- jsonb_pretty --- -------------------------------- --- { + --- "code": 200, + --- "host": "www.example.com",+ --- "tags": [ + --- "web", + --- "example.com" + --- ], + --- "message": "GET /" + --- } --- (1 row) -``` - -`jsonb`型の値の中のすべてのテキスト値に対して全文検索をする条件は次の通りです。 - -```sql -SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'string @ "started"'; --- jsonb_pretty --- ------------------------------------- --- { + --- "host": "www.example.com", + --- "tags": [ + --- "web", + --- "example.com" + --- ], + --- "message": "Server is started."+ --- } --- (1 row) -``` - -全文検索用に[Groongaのクエリー構文](http://groonga.org/ja/docs/reference/grn_expr/query_syntax.html)(`a OR b`という構文を使えます)を使うには`query("string", "...")`という構文を使います。 - -```sql -SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'query("string", "send OR server")'; --- jsonb_pretty --- ---------------------------------------------- --- { + --- "host": "www.example.com", + --- "tags": [ + --- "web", + --- "example.com" + --- ], + --- "message": "Server is started." + --- } --- { + --- "host": "mail.example.net", + --- "tags": [ + --- "mail", + --- "example.net" + --- ], + --- "message": "Send to <info �� example.com>."+ --- } --- (2 rows) -``` - -## 参考 - - * [`jsonb`サポート](../jsonb.html) - * [`@>`演算子](jsonb-contain.html) Added: ja/reference/operators/query-jsonb-v2.md (+106 -0) 100644 =================================================================== --- /dev/null +++ ja/reference/operators/query-jsonb-v2.md 2017-05-18 18:12:39 +0900 (9a8a48d) @@ -0,0 +1,106 @@ +--- +title: "&? operator for jsonb type" +upper_level: ../ +--- + +# `$?` operator for `jsonb` type + +## 概要 + +`$?` operator performs full text search against all texts in `jsonb` with query. + +クエリーの構文はWeb検索エンジンで使われている構文と似ています。たとえば、クエリーで`キーワード1 OR キーワード2`と書くとOR検索できます。 + +## 構文 + +```sql +column &? query +``` + +`column` is a column to be searched. It's `jsonb` type. + +`query`は全文検索で使うクエリーです。`text`型です。 + +`query`では[Groongaのクエリー構文](http://groonga.org/ja/docs/reference/grn_expr/query_syntax.html)を使います。 + +## 使い方 + +例に使うサンプルスキーマとデータは次の通りです。 + +```sql +CREATE TABLE logs ( + record jsonb +); + +CREATE INDEX pgroonga_logs_index ON logs USING pgroonga (record); + +INSERT INTO logs + VALUES ('{ + "message": "Server is started.", + "host": "www.example.com", + "tags": [ + "web", + "example.com" + ] + }'); +INSERT INTO logs + VALUES ('{ + "message": "GET /", + "host": "www.example.com", + "code": 200, + "tags": [ + "web", + "example.com" + ] + }'); +INSERT INTO logs + VALUES ('{ + "message": "Send to <info �� example.com>.", + "host": "mail.example.net", + "tags": [ + "mail", + "example.net" + ] + }'); +``` + +`@?`演算子を使うと`キーワード1 キーワード2`のように複数のキーワードを指定して全文検索できます。`キーワード1 OR キーワード2`のようにOR検索することもできます。 + +(読みやすくするためにPostgreSQL 9.5以降で使える[`jsonb_pretty()`関数]({{ site.postgresql_doc_base_url.ja }}/functions-json.html#functions-json-processing-table)を使っています。) + +```sql +SELECT jsonb_pretty(record) FROM logs WHERE record &? 'server OR mail'; +-- jsonb_pretty +-- ---------------------------------------------- +-- { + +-- "host": "www.example.com", + +-- "tags": [ + +-- "web", + +-- "example.com" + +-- ], + +-- "message": "Server is started." + +-- } +-- { + +-- "host": "mail.example.net", + +-- "tags": [ + +-- "mail", + +-- "example.net" + +-- ], + +-- "message": "Send to <info �� example.com>."+ +-- } +-- (2 rows) +``` + +## 参考 + + * [`jsonb` support](../jsonb.html) + + * [`&@` operator][match-jsonb-v2]: Full text search against all text data in `jsonb` by a keyword + + * [`` &` `` operator][script-jsonb-v2]: Advanced search by ECMAScript like query language + + * [`@>` operator][contain-jsonb]: Search by a `jsonb` data + +[match-jsonb-v2]:match-jsonb-v2.html +[script-jsonb-v2]:script-jsonb-v2.html +[contain-jsonb]:contain-jsonb.html Copied: ja/reference/operators/script-jsonb.md (+0 -0) 100% =================================================================== Modified: reference/index.md (+17 -11) =================================================================== --- reference/index.md 2017-05-09 09:44:01 +0900 (69776f7) +++ reference/index.md 2017-05-18 18:12:39 +0900 (640de8e) @@ -134,17 +134,17 @@ Supported types: `boolean`, `smallint`, `integer`, `bigint`, `real`, `double pre ### For `jsonb` - * [`&@` operator](operators/match-jsonb-v2.html): Full text search against all text data in `jsonb` by a keyword + * [`&@` operator][match-jsonb-v2]: Full text search against all text data in `jsonb` by a keyword - * [`&?` operator](operators/query-jsonb-v2.html): Full text search against all text data in `jsonb` by easy to use query language + * [`&?` operator][query-jsonb-v2]: Full text search against all text data in `jsonb` by easy to use query language - * [`` &` `` operator](operators/script-jsonb-v2.html): Advanced search by ECMAScript like query language + * [`` &` `` operator][script-jsonb-v2]: Advanced search by ECMAScript like query language - * [`@@` operator](operators/script-jsonb.html): Advanced search by ECMAScript like query language + * [`@@` operator][script-jsonb]: Advanced search by ECMAScript like query language - * Deprecated since 1.2.1. Use [`` &` `` operator](operators/script-jsonb-v2.html) instead. + * Deprecated since 1.2.1. Use [`` &` `` operator][script-jsonb-v2] instead. - * [`@>` operator](operators/contain-jsonb.html): Search by a `jsonb` data + * [`@>` operator][contain-jsonb]: Search by a `jsonb` data ## Operators v2 @@ -282,17 +282,17 @@ By `pgroonga.varchar_array_ops_v2` operator class: By `pgroonga.jsonb_ops_v2` operator class: - * [`&@` operator](operators/match-jsonb-v2.html): Full text search against all text data in `jsonb` by a keyword + * [`&@` operator][match-jsonb-v2]: Full text search against all text data in `jsonb` by a keyword - * [`&?` operator](operators/query-jsonb-v2.html): Full text search against all text data in `jsonb` by easy to use query language + * [`&?` operator][query-jsonb-v2]: Full text search against all text data in `jsonb` by easy to use query language - * [`` &` `` operator](operators/script-jsonb-v2.html): Advanced search by ECMAScript like query language + * [`` &` `` operator][script-jsonb-v2]: Advanced search by ECMAScript like query language - * [`@@` operator](operators/script-jsonb.html): Advanced search by ECMAScript like query language + * [`@@` operator][script-jsonb]: Advanced search by ECMAScript like query language * Don't use this operator class for newly written code. It's just for backward compatibility. - * [`@>` operator](operators/contain-jsonb.html): Search by a `jsonb` data + * [`@>` operator][contain-jsonb]: Search by a `jsonb` data ## Functions @@ -351,3 +351,9 @@ Normally, you don't need to tune PGroonga because PGroonga works well by default But you need to tune PGroonga in some cases such as a case that you need to handle a very large database. PGroonga uses Groonga as backend. It means that you can apply tuning knowledge for Groonga to PGroonga. See the following Groonga document to tune PGroonga: * [Tuning](http://groonga.org/docs/reference/tuning.html) + +[match-jsonb-v2]:operators/match-jsonb-v2.html +[query-jsonb-v2]:operators/query-jsonb-v2.html +[script-jsonb-v2]:operators/script-jsonb-v2.html +[script-jsonb]:operators/script-jsonb.html +[contain-jsonb]:operators/contain-jsonb.html Added: reference/operators/query-jsonb-v2.md (+106 -0) 100644 =================================================================== --- /dev/null +++ reference/operators/query-jsonb-v2.md 2017-05-18 18:12:39 +0900 (1fc7a0c) @@ -0,0 +1,106 @@ +--- +title: "&? operator for jsonb type" +upper_level: ../ +--- + +# `$?` operator for `jsonb` type + +## Summary + +`$?` operator performs full text search against all texts in `jsonb` with query. + +Query's syntax is similar to syntax that is used in Web search engine. For example, you can use OR search by `KEYWORD1 OR KEYWORD2` in query. + +## Syntax + +```sql +column &? query +``` + +`column` is a column to be searched. It's `jsonb` type. + +`query` is a query for full text search. It's `text` type. + +[Groonga's query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html) is used in `query`. + +## Usage + +Here are sample schema and data for examples: + +```sql +CREATE TABLE logs ( + record jsonb +); + +CREATE INDEX pgroonga_logs_index ON logs USING pgroonga (record); + +INSERT INTO logs + VALUES ('{ + "message": "Server is started.", + "host": "www.example.com", + "tags": [ + "web", + "example.com" + ] + }'); +INSERT INTO logs + VALUES ('{ + "message": "GET /", + "host": "www.example.com", + "code": 200, + "tags": [ + "web", + "example.com" + ] + }'); +INSERT INTO logs + VALUES ('{ + "message": "Send to <info �� example.com>.", + "host": "mail.example.net", + "tags": [ + "mail", + "example.net" + ] + }'); +``` + +You can perform full text search with multiple keywords by `&?` operator like `KEYWORD1 KEYWORD2`. You can also do OR search by `KEYWORD1 OR KEYWORD2`: + +(It uses [`jsonb_pretty()` function]({{ site.postgresql_doc_base_url.en }}/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE) provided since PostgreSQL 9.5 for readability.) + +```sql +SELECT jsonb_pretty(record) FROM logs WHERE record &? 'server OR mail'; +-- jsonb_pretty +-- ---------------------------------------------- +-- { + +-- "host": "www.example.com", + +-- "tags": [ + +-- "web", + +-- "example.com" + +-- ], + +-- "message": "Server is started." + +-- } +-- { + +-- "host": "mail.example.net", + +-- "tags": [ + +-- "mail", + +-- "example.net" + +-- ], + +-- "message": "Send to <info �� example.com>."+ +-- } +-- (2 rows) +``` + +## See also + + * [`jsonb` support](../jsonb.html) + + * [`&@` operator][match-jsonb-v2]: Full text search against all text data in `jsonb` by a keyword + + * [`` &` `` operator][script-jsonb-v2]: Advanced search by ECMAScript like query language + + * [`@>` operator][contain-jsonb]: Search by a `jsonb` data + +[match-jsonb-v2]:match-jsonb-v2.html +[script-jsonb-v2]:script-jsonb-v2.html +[contain-jsonb]:contain-jsonb.html