Kouhei Sutou
null+****@clear*****
Wed Jun 7 16:11:50 JST 2017
Kouhei Sutou 2017-06-07 16:11:50 +0900 (Wed, 07 Jun 2017) New Revision: b55293545cfff85f60f1cd8353137af8ddf7d72c https://github.com/pgroonga/pgroonga.github.io/commit/b55293545cfff85f60f1cd8353137af8ddf7d72c Message: script-jsonb-v2: add Copied files: reference/operators/script-jsonb-v2.md (from reference/operators/script-jsonb.md) Modified files: reference/operators/contain-jsonb.md reference/operators/match-jsonb-v2.md reference/operators/query-jsonb-v2.md reference/operators/script-jsonb.md Modified: reference/operators/contain-jsonb.md (+2 -2) =================================================================== --- reference/operators/contain-jsonb.md 2017-06-07 16:09:40 +0900 (67f523a) +++ reference/operators/contain-jsonb.md 2017-06-07 16:11:50 +0900 (399b317) @@ -82,7 +82,7 @@ SET enable_seqscan = off; Here is an example for match case: -(It uses [`jsonb_pretty()` function][jsonb-pretty] provided since PostgreSQL 9.5 for readability.) +(It uses [`jsonb_pretty()` function][postgresql-jsonb-pretty] provided since PostgreSQL 9.5 for readability.) ```sql SELECT jsonb_pretty(record) FROM logs WHERE record @> '{"host": "www.example.com"}'::jsonb; @@ -137,4 +137,4 @@ SELECT jsonb_pretty(record) FROM logs WHERE record @> '{"tags": ["mail", "web"]} [postgresql-jsonb-operators]:{{ site.postgresql_doc_base_url.en }}/functions-json.html#FUNCTIONS-JSONB-OP-TABLE -[jsonb-pretty]:{{ site.postgresql_doc_base_url.en }}/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE +[postgresql-jsonb-pretty]:{{ site.postgresql_doc_base_url.en }}/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE Modified: reference/operators/match-jsonb-v2.md (+2 -2) =================================================================== --- reference/operators/match-jsonb-v2.md 2017-06-07 16:09:40 +0900 (ca4e1d2) +++ reference/operators/match-jsonb-v2.md 2017-06-07 16:11:50 +0900 (20328da) @@ -72,7 +72,7 @@ INSERT INTO logs You can perform full text search with one keyword by `&@`: -(It uses [`jsonb_pretty()` function][jsonb-pretty] provided since PostgreSQL 9.5 for readability.) +(It uses [`jsonb_pretty()` function][postgresql-jsonb-pretty] provided since PostgreSQL 9.5 for readability.) ```sql SELECT jsonb_pretty(record) FROM logs WHERE record &@ 'server'; @@ -105,4 +105,4 @@ SELECT jsonb_pretty(record) FROM logs WHERE record &@ 'server'; [script-jsonb-v2]:script-jsonb-v2.html [contain-jsonb]:contain-jsonb.html -[jsonb-pretty]:{{ site.postgresql_doc_base_url.en }}/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE +[postgresql-jsonb-pretty]:{{ site.postgresql_doc_base_url.en }}/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE Modified: reference/operators/query-jsonb-v2.md (+2 -2) =================================================================== --- reference/operators/query-jsonb-v2.md 2017-06-07 16:09:40 +0900 (f5f32a6) +++ reference/operators/query-jsonb-v2.md 2017-06-07 16:11:50 +0900 (135e97d) @@ -76,7 +76,7 @@ INSERT INTO logs 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][jsonb-pretty] provided since PostgreSQL 9.5 for readability.) +(It uses [`jsonb_pretty()` function][postgresql-jsonb-pretty] provided since PostgreSQL 9.5 for readability.) ```sql SELECT jsonb_pretty(record) FROM logs WHERE record &? 'server OR mail'; @@ -117,4 +117,4 @@ SELECT jsonb_pretty(record) FROM logs WHERE record &? 'server OR mail'; [script-jsonb-v2]:script-jsonb-v2.html [contain-jsonb]:contain-jsonb.html -[jsonb-pretty]:{{ site.postgresql_doc_base_url.en }}/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE +[postgresql-jsonb-pretty]:{{ site.postgresql_doc_base_url.en }}/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE Copied: reference/operators/script-jsonb-v2.md (+15 -17) 87% =================================================================== --- reference/operators/script-jsonb.md 2017-06-07 16:09:40 +0900 (97f62ad) +++ reference/operators/script-jsonb-v2.md 2017-06-07 16:11:50 +0900 (c1c5c07) @@ -1,15 +1,15 @@ --- -title: "@@ operator for jsonb type" +title: "&` operator for jsonb type" upper_level: ../ --- -# `@@` operator for `jsonb` type +# `` &`` `` operator for `jsonb` type -## Summary +Since 1.2.1. -This operator is deprecated since 1.2.1. Use [`` &` `` operator][script-jsonb-v2] instead. +## Summary -`@@` operator is a PGroonga original operator. You can use complex condition that can't be written by [`@>` operator][contain-jsonb] such as range search. +`` &` `` operator is a PGroonga original operator. You can use complex condition that can't be written by [`@>` operator][contain-jsonb] such as range search. If you know [JsQuery][jsquery], you can understand like "PGroonga provides `jsonb` type related search features that are similar to JsQuery with different syntax". @@ -18,12 +18,12 @@ If you know [JsQuery][jsquery], you can understand like "PGroonga provides `json Here is the syntax of this operator: ```sql -jsonb_column @@ condition +jsonb_column &` condition ``` `jsonb_column` is a column that its type is `jsonb`. -`condition` is a `text` value used as query. It uses [Groonga's script syntax][groogna-script-syntax]. +`condition` is a `text` value used as query. It uses [Groonga's script syntax][groonga-script-syntax]. The operator returns `true` when `condition` matches `jsonb_column` value, `false` otherwise. @@ -163,14 +163,14 @@ The JSON is split to the following values. (They are part of all split values.) | `.["message"]|string|GET /` | `.["message"]` | `[.message, .["message"], message, ["message"]]` | `string` | | | `GET /` | | | `.["tags"][]|string|web` | `.["tags"]` | `[.tags, .["tags"], .["tags"][], tags, ["tags"], ["tags"][], []]` | `string` | | | `web` | | -You specify condition that matches split value to `@@` operator. If there is one or more split values that match specified condition in `jsonb` type value, the `jsonb` type value is matched. +You specify condition that matches split value to `` &` `` operator. If there is one or more split values that match specified condition in `jsonb` type value, the `jsonb` type value is matched. Here is a condition that searches `jsonb` type value that has `www.example.com` string: -(It uses [`jsonb_pretty()` function][jsonb-pretty] provided since PostgreSQL 9.5 for readability.) +(It uses [`jsonb_pretty()` function][postgresql-jsonb-pretty] provided since PostgreSQL 9.5 for readability.) ```sql -SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'string == "www.example.com"'; +SELECT jsonb_pretty(record) FROM logs WHERE record &` 'string == "www.example.com"'; -- jsonb_pretty -- ------------------------------------- -- { + @@ -196,7 +196,7 @@ SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'string == "www.example.co Here is a condition that searches `jsonb` type value that has number between `200` to `299` as `code` column value. The condition uses `paths @ "..."` syntax to use simple path format (`.code`) to specify path. ```sql -SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'paths @ ".code" && number >= 200 && number < 300'; +SELECT jsonb_pretty(record) FROM logs WHERE record &` 'paths @ ".code" && number >= 200 && number < 300'; -- jsonb_pretty -- -------------------------------- -- { + @@ -214,7 +214,7 @@ SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'paths @ ".code" && number Here is a condition for full text search from all text values in `jsonb` value type: ```sql -SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'string @ "started"'; +SELECT jsonb_pretty(record) FROM logs WHERE record &` 'string @ "started"'; -- jsonb_pretty -- ------------------------------------- -- { + @@ -231,7 +231,7 @@ SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'string @ "started"'; You can use [Groonga's query syntax][groonga-query-syntax] (`a OR b` can be used) for full text search by `query("string", "...")` syntax: ```sql -SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'query("string", "send OR server")'; +SELECT jsonb_pretty(record) FROM logs WHERE record &` 'query("string", "send OR server")'; -- jsonb_pretty -- ---------------------------------------------- -- { + @@ -259,12 +259,10 @@ SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'query("string", "send OR * [`@>` operator][contain-jsonb] - * [`` &` `` operator][script-jsonb-v2] - [jsonb]:../jsonb.html [contain-jsonb]:contain-jsonb.html -[script-jsonb-v2]:script-jsonb-v2.html + [jsquery]:https://github.com/postgrespro/jsquery [jq]:https://stedolan.github.io/jq/ @@ -273,4 +271,4 @@ SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'query("string", "send OR [groonga-script-syntax]:http://groonga.org/docs/reference/grn_expr/script_syntax.html -[jsonb-pretty]:{{ site.postgresql_doc_base_url.en }}/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE +[postgresql-jsonb-pretty]:{{ site.postgresql_doc_base_url.en }}/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE Modified: reference/operators/script-jsonb.md (+2 -2) =================================================================== --- reference/operators/script-jsonb.md 2017-06-07 16:09:40 +0900 (97f62ad) +++ reference/operators/script-jsonb.md 2017-06-07 16:11:50 +0900 (4e44c30) @@ -167,7 +167,7 @@ You specify condition that matches split value to `@@` operator. If there is one Here is a condition that searches `jsonb` type value that has `www.example.com` string: -(It uses [`jsonb_pretty()` function][jsonb-pretty] provided since PostgreSQL 9.5 for readability.) +(It uses [`jsonb_pretty()` function][postgresql-jsonb-pretty] provided since PostgreSQL 9.5 for readability.) ```sql SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'string == "www.example.com"'; @@ -273,4 +273,4 @@ SELECT jsonb_pretty(record) FROM logs WHERE record @@ 'query("string", "send OR [groonga-script-syntax]:http://groonga.org/docs/reference/grn_expr/script_syntax.html -[jsonb-pretty]:{{ site.postgresql_doc_base_url.en }}/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE +[postgresql-jsonb-pretty]:{{ site.postgresql_doc_base_url.en }}/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE -------------- next part -------------- HTML����������������������������... Download