-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documents for operators of v2 operator classes
- Loading branch information
Showing
10 changed files
with
583 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
title: "&@> operator" | ||
layout: en | ||
--- | ||
|
||
# `&@>` operator | ||
|
||
## Summary | ||
|
||
This operator uses v2 operator class. It doesn't provide backward compatibility until PGroonga 2.0.0. Use it carefully. | ||
|
||
`&@>` operator performs full text search by array of keywords. If one or more keywords are found, the record is matched. | ||
|
||
## Syntax | ||
|
||
```sql | ||
column &@> keywords | ||
``` | ||
|
||
`column` is a column to be searched. | ||
|
||
`keywords` is an array of keyword for full text search. It's `text[]` type. | ||
|
||
The operator returns `true` when one or more keyword in `keywords` are included in `column`. | ||
|
||
## Usage | ||
|
||
Here are sample schema and data for examples: | ||
|
||
```sql | ||
CREATE TABLE memos ( | ||
id integer, | ||
content text | ||
); | ||
|
||
CREATE INDEX pgroonga_content_index ON memos | ||
USING pgroonga (content pgroonga.text_full_text_search_ops_v2); | ||
``` | ||
|
||
```sql | ||
INSERT INTO memos VALUES (1, 'PostgreSQL is a relational database management system.'); | ||
INSERT INTO memos VALUES (2, 'Groonga is a fast full text search engine that supports all languages.'); | ||
INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga as index.'); | ||
INSERT INTO memos VALUES (4, 'There is groonga command.'); | ||
``` | ||
|
||
You can perform full text search with keywords by `&@>` operator: | ||
|
||
```sql | ||
SELECT * FROM memos WHERE content &@> ARRAY['engine', 'database']; | ||
-- id | content | ||
-- ----+------------------------------------------------------------------------ | ||
-- 1 | PostgreSQL is a relational database management system. | ||
-- 2 | Groonga is a fast full text search engine that supports all languages. | ||
-- (2 rows) | ||
``` | ||
|
||
`column &@> ARRAY['KEYWORD1', 'KEYWORD2']` equals to `column &? 'KEYWORD1 OR KEYWORD2'`. | ||
|
||
## See also | ||
|
||
* [`&@` operator](match-v2.html) | ||
|
||
* [`&?` operator](query-v2.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
title: "&@ operator" | ||
layout: en | ||
--- | ||
|
||
# `&@` operator | ||
|
||
## Summary | ||
|
||
This operator uses v2 operator class. It doesn't provide backward compatibility until PGroonga 2.0.0. Use it carefully. | ||
|
||
`&@` operator performs full text search by one keyword. | ||
|
||
## Syntax | ||
|
||
```sql | ||
column &@ keyword | ||
``` | ||
|
||
`column` is a column to be searched. | ||
|
||
`keyword` is a keyword for full text search. It's `text` type. | ||
|
||
## Usage | ||
|
||
Here are sample schema and data for examples: | ||
|
||
```sql | ||
CREATE TABLE memos ( | ||
id integer, | ||
content text | ||
); | ||
|
||
CREATE INDEX pgroonga_content_index ON memos | ||
USING pgroonga (content pgroonga.text_full_text_search_ops_v2); | ||
``` | ||
|
||
```sql | ||
INSERT INTO memos VALUES (1, 'PostgreSQL is a relational database management system.'); | ||
INSERT INTO memos VALUES (2, 'Groonga is a fast full text search engine that supports all languages.'); | ||
INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga as index.'); | ||
INSERT INTO memos VALUES (4, 'There is groonga command.'); | ||
``` | ||
|
||
You can perform full text search with one keyword by `&@` operator: | ||
|
||
```sql | ||
SELECT * FROM memos WHERE content &@ 'engine'; | ||
-- id | content | ||
-- ----+------------------------------------------------------------------------ | ||
-- 2 | Groonga is a fast full text search engine that supports all languages. | ||
-- (1 row) | ||
``` | ||
|
||
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). | ||
|
||
## See also | ||
|
||
* [`&?` operator](query-v2.html) | ||
|
||
* [`&@>` operator](match-contain-v2.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
title: "&^~ operator" | ||
layout: en | ||
--- | ||
|
||
# `&^~` operator | ||
|
||
## Summary | ||
|
||
This operator uses v2 operator class. It doesn't provide backward compatibility until PGroonga 2.0.0. Use it carefully. | ||
|
||
`&^~` operator performs [prefix RK search](http://groonga.org/docs/reference/operations/prefix_rk_search.html). R is for [Romaji](https://en.wikipedia.org/wiki/Romanization_of_Japanese). K is for [Katakana](https://en.wikipedia.org/wiki/Katakana). | ||
|
||
Prefix RK search is useful for Japanese. | ||
|
||
Prefix RK search is useful for implementing input completion. | ||
|
||
## Syntax | ||
|
||
```sql | ||
column &^~ prefix | ||
``` | ||
|
||
`column` is a column to be searched. | ||
|
||
`prefix` is a prefix to be found. It's `text` type. | ||
|
||
`column` values must be in Katakana. `prefix` must be in Romaji, Hiragana or Katakana. | ||
|
||
The operator returns `true` when the `column` value has `prefix`. | ||
|
||
## Usage | ||
|
||
Here are sample schema and data for examples: | ||
|
||
```sql | ||
CREATE TABLE tag_readings ( | ||
name text, | ||
katakana text, | ||
PRIMARY KEY (name, katakana) | ||
); | ||
|
||
CREATE INDEX pgroonga_tag_reading_katakana_index ON tag_readings | ||
USING pgroonga (katakana pgroonga.text_term_search_ops_v2); | ||
``` | ||
|
||
```sql | ||
INSERT INTO tag_readings VALUES ('PostgreSQL', 'ポストグレスキューエル'); | ||
INSERT INTO tag_readings VALUES ('PostgreSQL', 'ポスグレ'); | ||
INSERT INTO tag_readings VALUES ('Groonga', 'グルンガ'); | ||
INSERT INTO tag_readings VALUES ('PGroonga', 'ピージールンガ'); | ||
INSERT INTO tag_readings VALUES ('pglogical', 'ピージーロジカル'); | ||
``` | ||
|
||
You can perform prefix RK search with prefix in Romaji by `&^~` operator: | ||
|
||
```sql | ||
SELECT * FROM tag_readings WHERE katakana &^~ 'pi-ji-'; | ||
-- name | katakana | ||
-- -----------+------------------ | ||
-- PGroonga | ピージールンガ | ||
-- pglogical | ピージーロジカル | ||
-- (2 rows) | ||
``` | ||
|
||
You can also use Hiragana for prefix: | ||
|
||
```sql | ||
SELECT * FROM tag_readings WHERE katakana &^~ 'ぴーじー'; | ||
-- name | katakana | ||
-- -----------+------------------ | ||
-- PGroonga | ピージールンガ | ||
-- pglogical | ピージーロジカル | ||
-- (2 rows) | ||
``` | ||
|
||
You can also use Katakana for prefix: | ||
|
||
```sql | ||
SELECT * FROM tag_readings WHERE katakana &^~ 'ピージー'; | ||
-- name | katakana | ||
-- -----------+------------------ | ||
-- PGroonga | ピージールンガ | ||
-- pglogical | ピージーロジカル | ||
-- (2 rows) | ||
``` | ||
|
||
## See also | ||
|
||
* [`&^` operator](prefix-search-v2.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
title: "&^ operator" | ||
layout: en | ||
--- | ||
|
||
# `&^` operator | ||
|
||
## Summary | ||
|
||
This operator uses v2 operator class. It doesn't provide backward compatibility until PGroonga 2.0.0. Use it carefully. | ||
|
||
`&^` operator performs prefix search. | ||
|
||
Prefix search is useful for implementing input completion. | ||
|
||
## Syntax | ||
|
||
```sql | ||
column &^ prefix | ||
``` | ||
|
||
`column` is a column to be searched. | ||
|
||
`prefix` is a prefix to be found. It's `text` type. | ||
|
||
The operator returns `true` when the `column` value has `prefix`. | ||
|
||
## Usage | ||
|
||
Here are sample schema and data for examples: | ||
|
||
```sql | ||
CREATE TABLE tags ( | ||
name text PRIMARY KEY | ||
); | ||
|
||
CREATE INDEX pgroonga_tag_name_index ON tags | ||
USING pgroonga (name pgroonga.text_term_search_ops_v2); | ||
``` | ||
|
||
```sql | ||
INSERT INTO tags VALUES ('PostgreSQL'); | ||
INSERT INTO tags VALUES ('Groonga'); | ||
INSERT INTO tags VALUES ('PGroonga'); | ||
INSERT INTO tags VALUES ('pglogical'); | ||
``` | ||
|
||
You can perform prefix search with prefix by `&^` operator: | ||
|
||
```sql | ||
SELECT * FROM tags WHERE name &^ 'pg'; | ||
-- name | ||
-- ----------- | ||
-- PGroonga | ||
-- pglogical | ||
-- (2 rows) | ||
``` | ||
|
||
## See also | ||
|
||
* [`&^?` operator](prefix-rk-search-v2.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
title: "&?> operator for non jsonb types" | ||
layout: en | ||
--- | ||
|
||
# `&?>` operator for non jsonb types | ||
|
||
## Summary | ||
|
||
This operator uses v2 operator class. It doesn't provide backward compatibility until PGroonga 2.0.0. Use it carefully. | ||
|
||
`&?>` operator performs full text search by array of queries. If one or more queries are matched, the record is matched. | ||
|
||
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 &?> queries | ||
``` | ||
|
||
`column` is a column to be searched. | ||
|
||
`queries` is an array of query for full text search. It's `text[]` type. | ||
|
||
The operator returns `true` when one or more query in `queries` are matched against `column`. | ||
|
||
## Usage | ||
|
||
Here are sample schema and data for examples: | ||
|
||
```sql | ||
CREATE TABLE memos ( | ||
id integer, | ||
content text | ||
); | ||
|
||
CREATE INDEX pgroonga_content_index ON memos | ||
USING pgroonga (content pgroonga.text_full_text_search_ops_v2); | ||
``` | ||
|
||
```sql | ||
INSERT INTO memos VALUES (1, 'PostgreSQL is a relational database management system.'); | ||
INSERT INTO memos VALUES (2, 'Groonga is a fast full text search engine that supports all languages.'); | ||
INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga as index.'); | ||
INSERT INTO memos VALUES (4, 'There is groonga command.'); | ||
``` | ||
|
||
You can perform full text search with queries by `&?>` operator: | ||
|
||
```sql | ||
SELECT * FROM memos WHERE content &?> ARRAY['Groonga engine', 'PostgreSQL -PGroonga']; | ||
-- id | content | ||
-- ----+------------------------------------------------------------------------ | ||
-- 1 | PostgreSQL is a relational database management system. | ||
-- 2 | Groonga is a fast full text search engine that supports all languages. | ||
-- (2 rows) | ||
``` | ||
|
||
`Groonga engine` query matches against a record that its `id` is `2`. | ||
|
||
`PostgreSQL -PGroonga` query matches against a record that its `id` is `1`. | ||
|
||
## See also | ||
|
||
* [`&?` operator](query-v2.html) | ||
|
||
* [Groonga's query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html) | ||
|
||
* [`&@>` operator](match-contain-v2.html) |
Oops, something went wrong.