Skip to content

Commit

Permalink
pgroonga_text_array_regexp_ops_v2: add
Browse files Browse the repository at this point in the history
This also adds the `text[]` case to `regular-expression-v2`.
  • Loading branch information
kou committed Dec 9, 2024
1 parent 59c888d commit 8ccd82e
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 2 deletions.
12 changes: 11 additions & 1 deletion _po/ja/reference/index.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-09-09 01:38+0000\n"
"PO-Revision-Date: 2024-12-09 14:24+0900\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Japanese\n"
"Language: ja\n"
Expand Down Expand Up @@ -374,6 +374,16 @@ msgstr " * [`&=~`演算子][equal-query-v2]:便利なクエリー言語を使
msgid " * Since 3.0.0."
msgstr " * 3.0.0で追加。"

msgid ""
"#### `pgroonga_text_array_regexp_ops_v2` operator class {#text-array-regexp-"
"ops-v2}"
msgstr ""
"#### `pgroonga_text_array_regexp_ops_v2`演算子クラス {#text-regexp-array-ops-"
"v2}"

msgid "Since 3.2.5."
msgstr "3.2.5で追加。"

msgid "### For `varchar`"
msgstr "### `varchar`用"

Expand Down
54 changes: 53 additions & 1 deletion _po/ja/reference/operators/regular-expression-v2.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"PO-Revision-Date: 2023-08-13 09:53+0900\n"
"PO-Revision-Date: 2024-12-09 14:41+0900\n"

msgid ""
"---\n"
Expand Down Expand Up @@ -144,9 +144,23 @@ msgstr "## 構文"
msgid ""
"```sql\n"
"column &~ regular_expression\n"
"column &~ pgroonga_condition(query,\n"
" weights,\n"
" scorers,\n"
" schema_name,\n"
" index_name,\n"
" column_name,\n"
" fuzzy_max_distance_ratio)\n"
"```"
msgstr ""

msgid ""
"The first signature is simpler than others. The first signature is enough "
"for most cases."
msgstr ""
"1つ目の使い方は他の使い方よりもシンプルです。多くの場合は1つ目の使い方で十分"
"です。"

msgid ""
"`column` is a column to be searched. It's `text` type or `varchar` type."
msgstr "`column`は検索対象のカラムです。型は`text`型か`varchar`型です。"
Expand All @@ -166,6 +180,35 @@ msgstr ""
"`column`の値が`regular_expression`パターンにマッチしたら、その式は`true`を返"
"します。"

msgid ""
"The second signature uses [`pgroonga_condition` function][condition]. You "
"can specify not only a regular expression but also index information for "
"scoring and sequential search."
msgstr ""
"2つ目の使い方は[`pgroonga_condition`関数][condition]を使います。正規表現だけ"
"でなく、スコアーやシーケンシャルサーチで使われるインデックス情報も指定できま"
"す。"

msgid "The second signature is available since 3.2.5."
msgstr "2つ目の使い方は3.2.5から使えます。"

msgid ""
"`query` in [`pgroonga_condition` function][condition] is used as a regular "
"expression to be used as pattern. It's `text` type."
msgstr ""
"[`pgroonga_condition` function][condition]の`query`はパターンとして使う正規表"
"現です。`text`型です。"

msgid "See [`pgroonga_condition` function][condition] for details."
msgstr "詳細は[`pgroonga_condition`関数][condition]を参照してください。"

msgid ""
"Note that `fuzzy_max_distance_ratio` isn't used for regular expression "
"search."
msgstr ""
"正規表現検索では`fuzzy_max_distance_ratio`は使われないことに注意してくださ"
"い。"

msgid "## Operator classes"
msgstr "## 演算子クラス"

Expand All @@ -177,6 +220,9 @@ msgstr "この演算子を使うには次のどれかの演算子クラスを指
msgid " * `pgroonga_text_regexp_ops_v2`: For `text`"
msgstr " * `pgroonga_text_regexp_ops_v2`:`text`用"

msgid " * `pgroonga_text_array_regexp_ops_v2`: For `text[]`"
msgstr " * `pgroonga_text_array_regexp_ops_v2`:`text[]`用"

msgid " * `pgroonga_varchar_regexp_ops_v2`: For `varchar`"
msgstr " * `pgroonga_varchar_regexp_ops_v2`:`varchar`用"

Expand Down Expand Up @@ -290,6 +336,9 @@ msgid ""
msgstr ""
" * [`&~|`演算子][regular-expression-in-v2]:正規表現の配列を使った検索"

msgid " * [`pgroonga_condition` function][condition]"
msgstr " * [`pgroonga_condition`関数][condition]"

msgid " * [Onigmo's regular expression syntax document][onigmo-document]"
msgstr " * [Onigmoの正規表現構文のドキュメント][onigmo-document]"

Expand Down Expand Up @@ -333,3 +382,6 @@ msgstr ""

msgid "[regular-expression-in-v2]:regular-expression-in-v2.html"
msgstr ""

msgid "[condition]:../functions/pgroonga-condition.html"
msgstr ""
6 changes: 6 additions & 0 deletions ja/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ PGroongaは`pgroonga`スキーマに関数・演算子・演算子クラスな

* 3.0.0で追加。

#### `pgroonga_text_array_regexp_ops_v2`演算子クラス {#text-regexp-array-ops-v2}

3.2.5で追加。

* [`&~`演算子][regular-expression-v2]:正規表現を使った検索

### `varchar`

#### `pgroonga_varchar_term_search_ops_v2`演算子クラス(デフォルト) {#varchar-term-search-ops-v2}
Expand Down
25 changes: 25 additions & 0 deletions ja/reference/operators/regular-expression-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,41 @@ PostgreSQLは次のような組み込みの正規表現演算子を提供して

```sql
column &~ regular_expression
column &~ pgroonga_condition(query,
weights,
scorers,
schema_name,
index_name,
column_name,
fuzzy_max_distance_ratio)
```

1つ目の使い方は他の使い方よりもシンプルです。多くの場合は1つ目の使い方で十分です。

`column`は検索対象のカラムです。型は`text`型か`varchar`型です。

`regular_expression`はパターンとして使う正規表現です。`column`の型が`text`型のときは`text`型です。`column`の型が`varchar`型のときは`varchar`型です。

`column`の値が`regular_expression`パターンにマッチしたら、その式は`true`を返します。

2つ目の使い方は[`pgroonga_condition`関数][condition]を使います。正規表現だけでなく、スコアーやシーケンシャルサーチで使われるインデックス情報も指定できます。

2つ目の使い方は3.2.5から使えます。

[`pgroonga_condition` function][condition]`query`はパターンとして使う正規表現です。`text`型です。

詳細は[`pgroonga_condition`関数][condition]を参照してください。

正規表現検索では`fuzzy_max_distance_ratio`は使われないことに注意してください。

## 演算子クラス

この演算子を使うには次のどれかの演算子クラスを指定する必要があります。

* `pgroonga_text_regexp_ops_v2``text`

* `pgroonga_text_array_regexp_ops_v2``text[]`

* `pgroonga_varchar_regexp_ops_v2``varchar`

* `pgroonga_text_regexp_ops``text`
Expand Down Expand Up @@ -106,6 +127,8 @@ SELECT * FROM memos WHERE content &~ '\Apostgresql';

* [`&~|`演算子][regular-expression-in-v2]:正規表現の配列を使った検索

* [`pgroonga_condition`関数][condition]

* [Onigmoの正規表現構文のドキュメント][onigmo-document]

* [Groongaの正規表現サポートに関するドキュメント][groonga-regular-expression]
Expand All @@ -123,3 +146,5 @@ SELECT * FROM memos WHERE content &~ '\Apostgresql';
[groonga-regular-expression]:http://groonga.org/ja/docs/reference/regular_expression.html#regular-expression-index

[regular-expression-in-v2]:regular-expression-in-v2.html

[condition]:../functions/pgroonga-condition.html
6 changes: 6 additions & 0 deletions reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ All v2 operators supports PostgreSQL's [row level security][postgresql-row-level

* Since 3.0.0.

#### `pgroonga_text_array_regexp_ops_v2` operator class {#text-array-regexp-ops-v2}

Since 3.2.5.

* [`&~` operator][regular-expression-v2]: Search by a regular expression

### For `varchar`

#### `pgroonga_varchar_term_search_ops_v2` operator class (default) {#varchar-term-search-ops-v2}
Expand Down
25 changes: 25 additions & 0 deletions reference/operators/regular-expression-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,41 @@ Note that Groonga may search with regular expression pattern by sequential scan

```sql
column &~ regular_expression
column &~ pgroonga_condition(query,
weights,
scorers,
schema_name,
index_name,
column_name,
fuzzy_max_distance_ratio)
```

The first signature is simpler than others. The first signature is enough for most cases.

`column` is a column to be searched. It's `text` type or `varchar` type.

`regular_expression` is a regular expression to be used as pattern. It's `text` type for `text` type `column`. It's `varchar` type for `varchar` type `column`.

If `column` value is matched against `regular_expression` pattern, the expression returns `true`.

The second signature uses [`pgroonga_condition` function][condition]. You can specify not only a regular expression but also index information for scoring and sequential search.

The second signature is available since 3.2.5.

`query` in [`pgroonga_condition` function][condition] is used as a regular expression to be used as pattern. It's `text` type.

See [`pgroonga_condition` function][condition] for details.

Note that `fuzzy_max_distance_ratio` isn't used for regular expression search.

## Operator classes

You need to specify one of the following operator classes to use this operator:

* `pgroonga_text_regexp_ops_v2`: For `text`

* `pgroonga_text_array_regexp_ops_v2`: For `text[]`

* `pgroonga_varchar_regexp_ops_v2`: For `varchar`

* `pgroonga_text_regexp_ops`: For `text`
Expand Down Expand Up @@ -106,6 +127,8 @@ Why is "`PostgreSQL is a ...`" record matched? Remember that this operator norma

* [`&~|` operator][regular-expression-in-v2]: Search by an array of regular expressions

* [`pgroonga_condition` function][condition]

* [Onigmo's regular expression syntax document][onigmo-document]

* [Groonga's regular expression support document][groonga-regular-expression]
Expand All @@ -123,3 +146,5 @@ Why is "`PostgreSQL is a ...`" record matched? Remember that this operator norma
[groonga-regular-expression]:http://groonga.org/docs/reference/regular_expression.html#regular-expression-index

[regular-expression-in-v2]:regular-expression-in-v2.html

[condition]:../functions/pgroonga-condition.html

0 comments on commit 8ccd82e

Please sign in to comment.