Navigation Menu

Skip to content

Commit

Permalink
Translate @> partially
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 24, 2015
1 parent c3ef45f commit f4ab919
Show file tree
Hide file tree
Showing 2 changed files with 308 additions and 0 deletions.
189 changes: 189 additions & 0 deletions _po/ja/reference/operators/jsonb-contain.po
@@ -0,0 +1,189 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-10-24 17:58+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\"\n"
"layout: en\n"
"---"
msgstr ""
"---\n"
"title: \"@>演算子\"\n"
"layout: ja\n"
"---"

msgid "# `@>` operator"
msgstr "# `@>`演算子"

msgid "## Summary"
msgstr "## 概要"

msgid "PGroonga supports fast index search by `@>` operator."
msgstr "PGroongaは`@>`演算子の検索をインデックスを使って高速に実現できます。"

msgid ""
"[`@>` is a built-in PostgreSQL operator](http://www.postgresql.org/docs/curren"
"t/static/functions-json.html#FUNCTIONS-JSONB-OP-TABLE). `@>` returns true when"
" the right hand side `jsonb` is a subset of left hand side `jsonb`."
msgstr ""

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 ""

msgid "`jsonb_query` is a `jsonb` value used as query."
msgstr ""

msgid ""
"The operator returns `true` when `jsonb_query` is a sub set of `jsonb_column` "
"value, `false` otherwise."
msgstr ""

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](http://www.postgresql.org/docs/devel/stat"
"ic/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE) provided since Postgre"
"SQL 9.5 for readability.)"
msgstr ""
"(読みやすくするためにPostgreSQL 9.5以降で使える[`jsonb_pretty()`関数](http://www.postgresql.jp/d"
"ocument/current/html/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 condition `jsonb` value, all elements must be inclu"
"ded in the search target `jsonb` value. Position of element isn't cared. If th"
"ere are one or more elements that are included in the condition `jsonb` value "
"but aren't included in the search target `jsonb` value, record that have the s"
"earch target `jsonb` value isn't matched."
msgstr ""

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 ""

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 ""
119 changes: 119 additions & 0 deletions ja/reference/operators/jsonb-contain.md
@@ -0,0 +1,119 @@
---
title: "@>演算子"
layout: ja
---

# `@>`演算子

## 概要

PGroongaは`@>`演算子の検索をインデックスを使って高速に実現できます。

[`@>` is a built-in PostgreSQL operator](http://www.postgresql.org/docs/current/static/functions-json.html#FUNCTIONS-JSONB-OP-TABLE). `@>` returns true when the right hand side `jsonb` is a subset of left hand side `jsonb`.

## 構文

Here is the syntax of this operator:

```sql
jsonb_column @> jsonb_query
```

`jsonb_column` is a column that its type is `jsonb`.

`jsonb_query` is a `jsonb` value used as query.

The operator returns `true` when `jsonb_query` is a sub set of `jsonb_column` value, `false` otherwise.

## 使い方

例に使うサンプルスキーマとデータは次の通りです。

```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;
```

Here is an example for match case:

(読みやすくするためにPostgreSQL 9.5以降で使える[`jsonb_pretty()`関数](http://www.postgresql.jp/document/current/html/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)
```

Here is an example for not match case.

If you use an array in the condition `jsonb` value, all elements must be included in the search target `jsonb` value. Position of element isn't cared. If there are one or more elements that are included in the condition `jsonb` value but aren't included in the search target `jsonb` value, record that have the search target `jsonb` value isn't matched.

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 following `SELECT` returns no record:

```sql
SELECT jsonb_pretty(record) FROM logs WHERE record @> '{"tags": ["mail", "web"]}'::jsonb;
-- jsonb_pretty
-- --------------
-- (0 rows)
```

## 参考

* [`jsonb` support](../jsonb.html)
* [`@@` operator](jsonb-query.html)

0 comments on commit f4ab919

Please sign in to comment.