Kouhei Sutou
null+****@clear*****
Mon May 29 23:09:57 JST 2017
Kouhei Sutou 2017-05-29 23:09:57 +0900 (Mon, 29 May 2017) New Revision: 30ebe95b1d0e2162d7516c0ed434f4dd05a271da https://github.com/pgroonga/pgroonga.github.io/commit/30ebe95b1d0e2162d7516c0ed434f4dd05a271da Message: Document &@ for varchar[] Added files: reference/operators/contain-term-v2.md Modified files: reference/index.md reference/operators/match-v2.md reference/operators/query-in-v2.md Modified: reference/index.md (+7 -5) =================================================================== --- reference/index.md 2017-05-29 22:47:33 +0900 (f9b7045) +++ reference/index.md 2017-05-29 23:09:57 +0900 (e71212a) @@ -114,11 +114,11 @@ PGroonga defines functions, operators, operator classes and so on into `pgroonga #### `pgroonga.varchar_array_ops` operator class (default) {#varchar-array-ops} - * [`&@` operator](operators/match-term-v2.html): Exact match by a keyword + * [`&@` operator][contain-term-v2]: Check whether a term is included in an array of terms - * [`%%` operator](operators/match-term.html): Exact match by a keyword + * [`%%` operator][contain-term]: Check whether a term is included in an array of terms - * Deprecated since 1.2.1. Use [`&@` operator](operators/match-term-v2.html) instead. + * Deprecated since 1.2.1. Use [`&@` operator][contain-term-v2] instead. ### For boolean, numbers and timestamps @@ -276,9 +276,9 @@ If you use them, you need to use [incompatible case steps](../upgrade/#incompati #### `pgroonga.varchar_array_term_search_ops_v2` operator class {#varchar-array-term-search-ops-v2} - * [`&@` operator](operators/match-term-v2.html): Exact match by a keyword + * [`&@` operator][contain-term-v2]: Check whether a term is included in an array of terms - * [`%%` operator](operators/match-term.html): Exact match by a keyword + * [`%%` operator][contain-term]: Check whether a term is included in an array of terms * Don't use this operator class for newly written code. It's just for backward compatibility. @@ -360,6 +360,8 @@ But you need to tune PGroonga in some cases such as a case that you need to hand [match-in-v2]:operators/match-in-v2.html [query-in-v2]:operators/query-in-v2.html +[contain-term-v2]:operators/contain-term-v2.html +[contain-term]:operators/contain-term.html [prefix-search-in-v2]:operators/prefix-search-in-v2.html [prefix-rk-search-in-v2]:operators/prefix-rk-search-in-v2.html [match-jsonb-v2]:operators/match-jsonb-v2.html Added: reference/operators/contain-term-v2.md (+54 -0) 100644 =================================================================== --- /dev/null +++ reference/operators/contain-term-v2.md 2017-05-29 23:09:57 +0900 (4d086fd) @@ -0,0 +1,54 @@ +--- +title: "&@ operator for varchar[]" +upper_level: ../ +--- + +# `&@` operator for `varchar[]` + +## Summary + +This operator uses v2 operator class. It doesn't provide backward compatibility until PGroonga 2.0.0. Use it carefully. + +`&@` operator checks whether a term is included in an array of terms. + +## Syntax + +```sql +column &@ term +``` + +`column` is `varchar[]` type column to be searched. + +`term` is a term to be found. It's `varchar` type. + +## Usage + +Here are sample schema and data for examples: + +```sql +CREATE TABLE memos ( + id integer, + tags varchar(255)[] +); + +CREATE INDEX pgroonga_tags_index ON memos USING pgroonga (tags); +``` + +```sql +INSERT INTO memos VALUES (1, ARRAY['PostgreSQ']); +INSERT INTO memos VALUES (2, ARRAY['Groonga']); +INSERT INTO memos VALUES (3, ARRAY['PGroonga', 'PostgreSQL', 'Groonga']); +INSERT INTO memos VALUES (4, ARRAY['Groonga']); +``` + +You can find records that contain `'Groonga'` term in an array of terms by `&@` operator: + +```sql +SELECT * FROM memos WHERE tags &@ 'Groonga'; +-- id | tags +-- ----+------------------------------- +-- 2 | {Groonga} +-- 3 | {PGroonga,PostgreSQL,Groonga} +-- 4 | {Groonga} +-- (3 rows) +``` Modified: reference/operators/match-v2.md (+2 -2) =================================================================== --- reference/operators/match-v2.md 2017-05-29 22:47:33 +0900 (b1dea6a) +++ reference/operators/match-v2.md 2017-05-29 23:09:57 +0900 (cdec1a8) @@ -51,10 +51,10 @@ SELECT * FROM memos WHERE content &@ 'engine'; If you want to perform full text search with multiple keywords or AND/OR search, use [`&?` operator](query-v2.html). -If you want to perform full text search with multiple keywords OR search, use [`&@>` operator](match-contain-v2.html). +If you want to perform full text search with multiple keywords OR search, use [`&@>` operator](match-in-v2.html). ## See also * [`&?` operator](query-v2.html) - * [`&@>` operator](match-contain-v2.html) + * [`&@>` operator](match-in-v2.html) Modified: reference/operators/query-in-v2.md (+1 -1) =================================================================== --- reference/operators/query-in-v2.md 2017-05-29 22:47:33 +0900 (67d5ed7) +++ reference/operators/query-in-v2.md 2017-05-29 23:09:57 +0900 (d2f42ab) @@ -67,4 +67,4 @@ SELECT * FROM memos WHERE content &?> ARRAY['Groonga engine', 'PostgreSQL -PGroo * [Groonga's query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html) - * [`&@>` operator](match-contain-v2.html) + * [`&@>` operator](match-in-v2.html) -------------- next part -------------- HTML����������������������������...Download