[Groonga-commit] pgroonga/pgroonga.github.io at 1ea9a46 [master] Translate

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Oct 28 23:38:09 JST 2015


Kouhei Sutou	2015-10-28 23:38:09 +0900 (Wed, 28 Oct 2015)

  New Revision: 1ea9a46a3d6764348cec8a17ca1a37c5dbd130af
  https://github.com/pgroonga/pgroonga.github.io/commit/1ea9a46a3d6764348cec8a17ca1a37c5dbd130af

  Message:
    Translate

  Modified files:
    _po/ja/reference/operators/like.po
    ja/reference/operators/like.md
    reference/operators/like.md

  Modified: _po/ja/reference/operators/like.po (+98 -66)
===================================================================
--- _po/ja/reference/operators/like.po    2015-10-28 23:22:58 +0900 (d7d0f6f)
+++ _po/ja/reference/operators/like.po    2015-10-28 23:38:09 +0900 (9a932e2)
@@ -1,7 +1,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"PO-Revision-Date: 2015-10-25 22:10+0900\n"
+"PO-Revision-Date: 2015-10-28 23:36+0900\n"
 "Language: ja\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -27,12 +27,31 @@ msgstr "## 概要"
 
 msgid ""
 "PGroonga converts `column LIKE '%KEYWORD%'` condition to `column %% 'KEYWORD'`"
-" internally. [`%%` operator](match.html) does full text search with index. It'"
-"s faster than `LIKE` operator without index."
+" internally. [`%%` operator](match.html) performs full text search with index."
+" It's faster than `LIKE` operator without index."
 msgstr ""
 "PGroongaは内部的に`column LIKE '%キーワード%'`条件を`column %% 'キーワード'`条件に変換します。[`%%`演算子](m"
 "atch.html)はインデックスを使って全文検索をします。これはインデックスを使わない`LIKE`演算子より速いです。"
 
+msgid ""
+"`column LIKE '%KEYWORD%'` with index is slower than `column %% 'KEYWORD'` with"
+" index because `column LIKE '%KEYWORD%'` with index needs \"[Recheck]\"(http://w"
+"ww.postgresql.org/docs/{{ site.postgresql_short_version }}/static/index-scanni"
+"ng.html). `column %% 'KEYWORD'` doesn't need \"Recheck\"."
+msgstr ""
+"インデックスを使った`column LIKE '%キーワード%'`は`column %% 'キーワード'`よりも遅いです。これは、インデックスを使った`co"
+"lumn LIKE '%キーワード%'`は「[再検査](https://www.postgresql.jp/document/{{ site.postgre"
+"sql_short_version }}/html/index-scanning.html)」する必要があるからです。`column %% 'キーワード'`"
+"は「再検査」する必要がありません。"
+
+msgid ""
+"The original `LIKE` operator searches against text as is. But `%%` operator pe"
+"rforms full text search against normalized text. It means that search result o"
+"f `LIKE` operator with index needs \"Recheck\"."
+msgstr ""
+"元の`LIKE`演算子は対象テキストに対して検索します。しかし、`%%`演算子は正規化したテキストに対して検索します。そのため、インデックスを使って`LIK"
+"E`演算子の検索を実行した場合は「再検査」が必要になります。"
+
 msgid "## Syntax"
 msgstr "## 構文"
 
@@ -48,18 +67,8 @@ msgstr ""
 msgid "`column` is a column to be searched."
 msgstr "`column`は検索対象のカラムです。"
 
-msgid ""
-"`pattern` is a search pattern. It's `text` type. It must be `'%KEYWORD%'` form"
-"at."
-msgstr "`pattern`は検索パターンです。`text`型です。`'%キーワード%'`というフォーマットではなければいけません。"
-
-msgid ""
-"Both beginning `%` and ending `%` are important. `'KEYWORD%'`, `'%KEYWORD'` an"
-"d so on aren't converted to `column %% 'KEYWORD'`. PGroonga returns no records"
-" for these patterns. Because PGroonga can't search these patterns with index."
-msgstr ""
-"最初の`%`と最後の`%`はどちらも重要です。`'キーワード%'`、`'%キーワード'`などは`column %% 'キーワード'`に変換されます。このよう"
-"なパターンを指定するとPGroongaは1件もレコードを返しません。なぜならPGroongaはインデックスなしではこれらのパターンを検索できないからです。"
+msgid "`pattern` is a search pattern. It's `text` type."
+msgstr "`pattern`は検索パターンです。`text`型です。"
 
 msgid "## Usage"
 msgstr "## 使い方"
@@ -99,28 +108,14 @@ msgstr ""
 "INSERT INTO memos VALUES (4, 'groongaコマンドがあります。');\n"
 "```"
 
-msgid ""
-"The original `LIKE` operator searches against text as is. But `%%` operator do"
-"es full text search against normalized text. It means that search result of `L"
-"IKE` operator with index and search result of the original `LIKE` operator may"
-" be different."
-msgstr ""
-"元の`LIKE`演算子は対象テキストに対して検索します。しかし、`%%`演算子は正規化したテキストに対して検索します。これは、インデックスを使った`LIKE"
-"`演算子の検索結果と、元の`LIKE`演算子の検索結果は異なるということです。"
-
-msgid ""
-"For example, the original `LIKE` operator searches with case sensitive. But `L"
-"IKE` operator with index searches with case insensitive."
-msgstr "たとえば、元の`LIKE`演算子は大文字小文字を区別して検索します。しかし、インデックスを使った`LIKE`演算子は大文字小文字を区別しません。"
-
-msgid "A search result of the original `LIKE` operator:"
-msgstr "元の`LIKE`演算子の結果です。"
+msgid "You can perform `LIKE` operator with index:"
+msgstr "インデックスを使って`LIKE`演算子を実行できます。"
 
 msgid ""
 "```sql\n"
-"SET enable_seqscan = on;\n"
-"SET enable_indexscan = off;\n"
-"SET enable_bitmapscan = off;"
+"SET enable_seqscan = off;\n"
+"SET enable_indexscan = on;\n"
+"SET enable_bitmapscan = on;"
 msgstr ""
 
 msgid ""
@@ -138,18 +133,34 @@ msgstr ""
 "-- (1 row)\n"
 "```"
 
-msgid "A search result of `LIKE` operator with index:"
-msgstr "インデックスを使った`LIKE`演算子の結果です。"
+msgid ""
+"The default operator class of PGroonga index for `text` type can't find any re"
+"cords with partial alphabet keyword. For example, you can't find record with `"
+"roonga` keyword:"
+msgstr ""
+"PGroongaのインデックスが適用している`text`型用のデフォルトのオペレータークラスは、キーワードがアルファベットのみだった場合、キーワードの一部だ"
+"けで検索してもヒットしません。たとえば、`roonga`というキーワードではヒットしません。"
+
+msgid ""
+"SELECT * FROM memos WHERE content LIKE '%roonga%';\n"
+"--  id | content \n"
+"-- ----+---------\n"
+"-- (0 rows)\n"
+"```"
+msgstr ""
+
+msgid "But you can find some records with `roonga` keyword without index:"
+msgstr "インデックスを使わない場合は`roonga`というキーワードでもヒットします。"
 
 msgid ""
 "```sql\n"
-"SET enable_seqscan = off;\n"
-"SET enable_indexscan = on;\n"
-"SET enable_bitmapscan = on;"
+"SET enable_seqscan = on;\n"
+"SET enable_indexscan = off;\n"
+"SET enable_bitmapscan = off;"
 msgstr ""
 
 msgid ""
-"SELECT * FROM memos WHERE content LIKE '%groonga%';\n"
+"SELECT * FROM memos WHERE content LIKE '%roonga%';\n"
 "--  id |                                content                               "
 "  \n"
 "-- ----+----------------------------------------------------------------------"
@@ -161,7 +172,7 @@ msgid ""
 "-- (3 rows)\n"
 "```"
 msgstr ""
-"SELECT * FROM memos WHERE content LIKE '%groonga%';\n"
+"SELECT * FROM memos WHERE content LIKE '%roonga%';\n"
 "--  id |                                  content                             "
 "     \n"
 "-- ----+----------------------------------------------------------------------"
@@ -172,20 +183,36 @@ msgstr ""
 "-- (3 rows)\n"
 "```"
 
-msgid ""
-"If you want to get the same result by both `LIKE` operator with index and the "
-"original `LIKE` operator, use the following tokenizer and normalizer:"
-msgstr "インデックスを使った`LIKE`演算子の結果と元の`LIKE`演算子の結果を同じにしたい場合は次のトークナイザーとノーマライザーを使います。"
+msgid "You can find records by prefix alphabet keyword such as `Gro`:"
+msgstr "キーワードがアルファベットだけだった場合でも、`Gro`のようにキーワードの先頭部分を指定した場合はヒットします。"
 
 msgid ""
-"  * Tokenizer: `TokenBigramSplitSymbolAlphaDigit`\n"
-"  * Normalizer: None"
+"SELECT * FROM memos WHERE content LIKE '%Gro%';\n"
+"--  id |                                content                               "
+"  \n"
+"-- ----+----------------------------------------------------------------------"
+"--\n"
+"--   2 | Groonga is a fast full text search engine that supports all languages"
+".\n"
+"--   3 | PGroonga is a PostgreSQL extension that uses Groonga as index.\n"
+"-- (2 rows)\n"
+"```"
 msgstr ""
-"  * トークナイザー: `TokenBigramSplitSymbolAlphaDigit`\n"
-"  * ノーマライザー: なし"
+"SELECT * FROM memos WHERE content LIKE '%Gro%';\n"
+"--  id |                                  content                             "
+"     \n"
+"-- ----+----------------------------------------------------------------------"
+"-----\n"
+"--   2 | Groongaは日本語対応の高速な全文検索エンジンです。\n"
+"--   3 | PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。\n"
+"-- (2 rows)\n"
+"```"
 
-msgid "Here is a concrete example:"
-msgstr "具体例は次の通りです。"
+msgid "If you want to search by partial alphabet keyword, there are two approaches."
+msgstr "キーワードがアルファベットの場合でも、キーワードの一部で検索できるようにする方法は2つあります。"
+
+msgid "The first approach is using the `TokenBigramSplitSymbolAlphaDigit` tokenizer:"
+msgstr "最初の方法は`TokenBigramSplitSymbolAlphaDigit`トークナイザーを使う方法です。"
 
 msgid ""
 "```sql\n"
@@ -196,27 +223,32 @@ msgid ""
 "CREATE INDEX pgroonga_content_index\n"
 "          ON memos\n"
 "       USING pgroonga (content)\n"
-"        WITH (tokenizer='TokenBigramSplitSymbolAlphaDigit',\n"
-"              normalizer='');\n"
+"        WITH (tokenizer='TokenBigramSplitSymbolAlphaDigit');\n"
 "```"
 msgstr ""
 
-msgid ""
-"You can get the same result as the original `LIKE` operator with `LIKE` operat"
-"or with index:"
-msgstr "元の`LIKE`演算子とインデックスを使った`LIKE`演算子で同じ結果が返ります。"
+msgid "You can find records by `roonga`:"
+msgstr "これで`roonga`でもヒットするようになります。"
 
 msgid ""
-"Normally, the default configuration returns better result for full text search"
-" rather than the original `LIKE` operator. Think about which result is better "
-"for users before you change the default configuration."
+"See [Customization in `CREATE INDEX USING pgroonga`](../create-index-using-pgr"
+"oonga.html#customization) for tokenizer."
 msgstr ""
-"通常、デフォルトの設定は元の`LIKE`演算子よりも適切な全文検索結果を返す設定です。もし、デフォルトの設定をするときは、変更する前にユーザーにとてどのよう"
-"な結果が適切かを考えてください。"
+"トークナイザーをカスタマイズする方法については[`CREATE INDEX USING pgroonga`のカスタマイズ](../create-index-"
+"using-pgroonga.html#customization)を参照してください。"
+
+msgid "The second approach is using `pgroonga.text_regexp_ops` operator class:"
+msgstr "2つめの方法は`pgroonga.text_regexp_ops`オペレータークラスを使う方法です。"
 
 msgid ""
-"See [Customization in `CREATE INDEX USING pgroonga`](../create-index-using-pgr"
-"oonga.html#customization) for tokenizer and normalizer."
+"CREATE INDEX pgroonga_content_index\n"
+"          ON memos\n"
+"       USING pgroonga (content pgroonga.text_regexp_ops);\n"
+"```"
+msgstr ""
+
+msgid "## See also"
+msgstr "## 参考"
+
+msgid "  * [`CREATE INDEX USING pgroonga`](../create-index-using-pgroonga.html)"
 msgstr ""
-"トークナイザーとノーマライザーをカスタマイズする方法については[`CREATE INDEX USING pgroonga`のカスタマイズ](../creat"
-"e-index-using-pgroonga.html#customization)を参照してください。"

  Modified: ja/reference/operators/like.md (+80 -26)
===================================================================
--- ja/reference/operators/like.md    2015-10-28 23:22:58 +0900 (681ac7c)
+++ ja/reference/operators/like.md    2015-10-28 23:38:09 +0900 (eec6c75)
@@ -9,6 +9,11 @@ layout: ja
 
 PGroongaは内部的に`column LIKE '%キーワード%'`条件を`column %% 'キーワード'`条件に変換します。[`%%`演算子](match.html)はインデックスを使って全文検索をします。これはインデックスを使わない`LIKE`演算子より速いです。
 
+インデックスを使った`column LIKE '%キーワード%'`は`column %% 'キーワード'`よりも遅いです。これは、インデックスを使った`column LIKE '%キーワード%'`は「[再検査](https://www.postgresql.jp/document/{{ site.postgresql_short_version }}/html/index-scanning.html)」する必要があるからです。`column %% 'キーワード'`は「再検査」する必要がありません。
+
+元の`LIKE`演算子は対象テキストに対して検索します。しかし、`%%`演算子は正規化したテキストに対して検索します。そのため、インデックスを使って`LIKE`演算子の検索を実行した場合は「再検査」が必要になります。
+
+
 ## 構文
 
 この演算子の構文は次の通りです。
@@ -19,9 +24,7 @@ column LIKE pattern
 
 `column`は検索対象のカラムです。
 
-`pattern`は検索パターンです。`text`型です。`'%キーワード%'`というフォーマットではなければいけません。
-
-最初の`%`と最後の`%`はどちらも重要です。`'キーワード%'`、`'%キーワード'`などは`column %% 'キーワード'`に変換されます。このようなパターンを指定するとPGroongaは1件もレコードを返しません。なぜならPGroongaはインデックスなしではこれらのパターンを検索できないからです。
+`pattern`は検索パターンです。`text`型です。
 
 ## 使い方
 
@@ -43,16 +46,12 @@ INSERT INTO memos VALUES (3, 'PGroongaはインデックスとしてGroongaを
 INSERT INTO memos VALUES (4, 'groongaコマンドがあります。');
 ```
 
-元の`LIKE`演算子は対象テキストに対して検索します。しかし、`%%`演算子は正規化したテキストに対して検索します。これは、インデックスを使った`LIKE`演算子の検索結果と、元の`LIKE`演算子の検索結果は異なるということです。
-
-たとえば、元の`LIKE`演算子は大文字小文字を区別して検索します。しかし、インデックスを使った`LIKE`演算子は大文字小文字を区別しません。
-
-元の`LIKE`演算子の結果です。
+インデックスを使って`LIKE`演算子を実行できます。
 
 ```sql
-SET enable_seqscan = on;
-SET enable_indexscan = off;
-SET enable_bitmapscan = off;
+SET enable_seqscan = off;
+SET enable_indexscan = on;
+SET enable_bitmapscan = on;
 
 SELECT * FROM memos WHERE content LIKE '%groonga%';
 --  id |           content           
@@ -61,14 +60,27 @@ SELECT * FROM memos WHERE content LIKE '%groonga%';
 -- (1 row)
 ```
 
-インデックスを使った`LIKE`演算子の結果です。
+PGroongaのインデックスが適用している`text`型用のデフォルトのオペレータークラスは、キーワードがアルファベットのみだった場合、キーワードの一部だけで検索してもヒットしません。たとえば、`roonga`というキーワードではヒットしません。
 
 ```sql
 SET enable_seqscan = off;
 SET enable_indexscan = on;
 SET enable_bitmapscan = on;
 
-SELECT * FROM memos WHERE content LIKE '%groonga%';
+SELECT * FROM memos WHERE content LIKE '%roonga%';
+--  id | content 
+-- ----+---------
+-- (0 rows)
+```
+
+インデックスを使わない場合は`roonga`というキーワードでもヒットします。
+
+```sql
+SET enable_seqscan = on;
+SET enable_indexscan = off;
+SET enable_bitmapscan = off;
+
+SELECT * FROM memos WHERE content LIKE '%roonga%';
 --  id |                                  content                                  
 -- ----+---------------------------------------------------------------------------
 --   2 | Groongaは日本語対応の高速な全文検索エンジンです。
@@ -77,12 +89,24 @@ SELECT * FROM memos WHERE content LIKE '%groonga%';
 -- (3 rows)
 ```
 
-インデックスを使った`LIKE`演算子の結果と元の`LIKE`演算子の結果を同じにしたい場合は次のトークナイザーとノーマライザーを使います。
+キーワードがアルファベットだけだった場合でも、`Gro`のようにキーワードの先頭部分を指定した場合はヒットします。
+
+```sql
+SET enable_seqscan = off;
+SET enable_indexscan = on;
+SET enable_bitmapscan = on;
+
+SELECT * FROM memos WHERE content LIKE '%Gro%';
+--  id |                                  content                                  
+-- ----+---------------------------------------------------------------------------
+--   2 | Groongaは日本語対応の高速な全文検索エンジンです。
+--   3 | PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。
+-- (2 rows)
+```
 
-  * トークナイザー: `TokenBigramSplitSymbolAlphaDigit`
-  * ノーマライザー: なし
+キーワードがアルファベットの場合でも、キーワードの一部で検索できるようにする方法は2つあります。
 
-具体例は次の通りです。
+最初の方法は`TokenBigramSplitSymbolAlphaDigit`トークナイザーを使う方法です。
 
 ```sql
 DROP INDEX IF EXISTS pgroonga_content_index;
@@ -90,24 +114,54 @@ DROP INDEX IF EXISTS pgroonga_content_index;
 CREATE INDEX pgroonga_content_index
           ON memos
        USING pgroonga (content)
-        WITH (tokenizer='TokenBigramSplitSymbolAlphaDigit',
-              normalizer='');
+        WITH (tokenizer='TokenBigramSplitSymbolAlphaDigit');
 ```
 
-元の`LIKE`演算子とインデックスを使った`LIKE`演算子で同じ結果が返ります。
+これで`roonga`でもヒットするようになります。
 
 ```sql
 SET enable_seqscan = off;
 SET enable_indexscan = on;
 SET enable_bitmapscan = on;
 
-SELECT * FROM memos WHERE content LIKE '%groonga%';
---  id |           content           
--- ----+-----------------------------
+SELECT * FROM memos WHERE content LIKE '%roonga%';
+--  id |                                  content                                  
+-- ----+---------------------------------------------------------------------------
+--   2 | Groongaは日本語対応の高速な全文検索エンジンです。
+--   3 | PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。
 --   4 | groongaコマンドがあります。
--- (1 row)
+-- (3 rows)
+```
+
+トークナイザーをカスタマイズする方法については[`CREATE INDEX USING pgroonga`のカスタマイズ](../create-index-using-pgroonga.html#customization)を参照してください。
+
+2つめの方法は`pgroonga.text_regexp_ops`オペレータークラスを使う方法です。
+
+```sql
+DROP INDEX IF EXISTS pgroonga_content_index;
+
+CREATE INDEX pgroonga_content_index
+          ON memos
+       USING pgroonga (content pgroonga.text_regexp_ops);
+```
+
+You can find records by `rooonga`:
+
+```sql
+SET enable_seqscan = off;
+SET enable_indexscan = on;
+SET enable_bitmapscan = on;
+
+SELECT * FROM memos WHERE content LIKE '%roonga%';
+--  id |                                  content                                  
+-- ----+---------------------------------------------------------------------------
+--   2 | Groongaは日本語対応の高速な全文検索エンジンです。
+--   3 | PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。
+--   4 | groongaコマンドがあります。
+-- (3 rows)
 ```
 
-通常、デフォルトの設定は元の`LIKE`演算子よりも適切な全文検索結果を返す設定です。もし、デフォルトの設定をするときは、変更する前にユーザーにとてどのような結果が適切かを考えてください。
+## 参考
+
+  * [`CREATE INDEX USING pgroonga`](../create-index-using-pgroonga.html)
 
-トークナイザーとノーマライザーをカスタマイズする方法については[`CREATE INDEX USING pgroonga`のカスタマイズ](../create-index-using-pgroonga.html#customization)を参照してください。

  Modified: reference/operators/like.md (+81 -27)
===================================================================
--- reference/operators/like.md    2015-10-28 23:22:58 +0900 (1280592)
+++ reference/operators/like.md    2015-10-28 23:38:09 +0900 (4d47469)
@@ -7,7 +7,12 @@ layout: en
 
 ## Summary
 
-PGroonga converts `column LIKE '%KEYWORD%'` condition to `column %% 'KEYWORD'` internally. [`%%` operator](match.html) does full text search with index. It's faster than `LIKE` operator without index.
+PGroonga converts `column LIKE '%KEYWORD%'` condition to `column %% 'KEYWORD'` internally. [`%%` operator](match.html) performs full text search with index. It's faster than `LIKE` operator without index.
+
+`column LIKE '%KEYWORD%'` with index is slower than `column %% 'KEYWORD'` with index because `column LIKE '%KEYWORD%'` with index needs "[Recheck]"(http://www.postgresql.org/docs/{{ site.postgresql_short_version }}/static/index-scanning.html). `column %% 'KEYWORD'` doesn't need "Recheck".
+
+The original `LIKE` operator searches against text as is. But `%%` operator performs full text search against normalized text. It means that search result of `LIKE` operator with index needs "Recheck".
+
 
 ## Syntax
 
@@ -19,9 +24,7 @@ column LIKE pattern
 
 `column` is a column to be searched.
 
-`pattern` is a search pattern. It's `text` type. It must be `'%KEYWORD%'` format.
-
-Both beginning `%` and ending `%` are important. `'KEYWORD%'`, `'%KEYWORD'` and so on aren't converted to `column %% 'KEYWORD'`. PGroonga returns no records for these patterns. Because PGroonga can't search these patterns with index.
+`pattern` is a search pattern. It's `text` type.
 
 ## Usage
 
@@ -43,16 +46,12 @@ INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groon
 INSERT INTO memos VALUES (4, 'There is groonga command.');
 ```
 
-The original `LIKE` operator searches against text as is. But `%%` operator does full text search against normalized text. It means that search result of `LIKE` operator with index and search result of the original `LIKE` operator may be different.
-
-For example, the original `LIKE` operator searches with case sensitive. But `LIKE` operator with index searches with case insensitive.
-
-A search result of the original `LIKE` operator:
+You can perform `LIKE` operator with index:
 
 ```sql
-SET enable_seqscan = on;
-SET enable_indexscan = off;
-SET enable_bitmapscan = off;
+SET enable_seqscan = off;
+SET enable_indexscan = on;
+SET enable_bitmapscan = on;
 
 SELECT * FROM memos WHERE content LIKE '%groonga%';
 --  id |          content          
@@ -61,14 +60,27 @@ SELECT * FROM memos WHERE content LIKE '%groonga%';
 -- (1 row)
 ```
 
-A search result of `LIKE` operator with index:
+The default operator class of PGroonga index for `text` type can't find any records with partial alphabet keyword. For example, you can't find record with `roonga` keyword:
 
 ```sql
 SET enable_seqscan = off;
 SET enable_indexscan = on;
 SET enable_bitmapscan = on;
 
-SELECT * FROM memos WHERE content LIKE '%groonga%';
+SELECT * FROM memos WHERE content LIKE '%roonga%';
+--  id | content 
+-- ----+---------
+-- (0 rows)
+```
+
+But you can find some records with `roonga` keyword without index:
+
+```sql
+SET enable_seqscan = on;
+SET enable_indexscan = off;
+SET enable_bitmapscan = off;
+
+SELECT * FROM memos WHERE content LIKE '%roonga%';
 --  id |                                content                                 
 -- ----+------------------------------------------------------------------------
 --   2 | Groonga is a fast full text search engine that supports all languages.
@@ -77,12 +89,24 @@ SELECT * FROM memos WHERE content LIKE '%groonga%';
 -- (3 rows)
 ```
 
-If you want to get the same result by both `LIKE` operator with index and the original `LIKE` operator, use the following tokenizer and normalizer:
+You can find records by prefix alphabet keyword such as `Gro`:
+
+```sql
+SET enable_seqscan = off;
+SET enable_indexscan = on;
+SET enable_bitmapscan = on;
+
+SELECT * FROM memos WHERE content LIKE '%Gro%';
+--  id |                                content                                 
+-- ----+------------------------------------------------------------------------
+--   2 | Groonga is a fast full text search engine that supports all languages.
+--   3 | PGroonga is a PostgreSQL extension that uses Groonga as index.
+-- (2 rows)
+```
 
-  * Tokenizer: `TokenBigramSplitSymbolAlphaDigit`
-  * Normalizer: None
+If you want to search by partial alphabet keyword, there are two approaches.
 
-Here is a concrete example:
+The first approach is using the `TokenBigramSplitSymbolAlphaDigit` tokenizer:
 
 ```sql
 DROP INDEX IF EXISTS pgroonga_content_index;
@@ -90,24 +114,54 @@ DROP INDEX IF EXISTS pgroonga_content_index;
 CREATE INDEX pgroonga_content_index
           ON memos
        USING pgroonga (content)
-        WITH (tokenizer='TokenBigramSplitSymbolAlphaDigit',
-              normalizer='');
+        WITH (tokenizer='TokenBigramSplitSymbolAlphaDigit');
 ```
 
-You can get the same result as the original `LIKE` operator with `LIKE` operator with index:
+You can find records by `roonga`:
 
 ```sql
 SET enable_seqscan = off;
 SET enable_indexscan = on;
 SET enable_bitmapscan = on;
 
-SELECT * FROM memos WHERE content LIKE '%groonga%';
---  id |          content          
--- ----+---------------------------
+SELECT * FROM memos WHERE content LIKE '%roonga%';
+--  id |                                content                                 
+-- ----+------------------------------------------------------------------------
+--   2 | Groonga is a fast full text search engine that supports all languages.
+--   3 | PGroonga is a PostgreSQL extension that uses Groonga as index.
 --   4 | There is groonga command.
--- (1 row)
+-- (3 rows)
+```
+
+See [Customization in `CREATE INDEX USING pgroonga`](../create-index-using-pgroonga.html#customization) for tokenizer.
+
+The second approach is using `pgroonga.text_regexp_ops` operator class:
+
+```sql
+DROP INDEX IF EXISTS pgroonga_content_index;
+
+CREATE INDEX pgroonga_content_index
+          ON memos
+       USING pgroonga (content pgroonga.text_regexp_ops);
+```
+
+You can find records by `rooonga`:
+
+```sql
+SET enable_seqscan = off;
+SET enable_indexscan = on;
+SET enable_bitmapscan = on;
+
+SELECT * FROM memos WHERE content LIKE '%roonga%';
+--  id |                                content                                 
+-- ----+------------------------------------------------------------------------
+--   2 | Groonga is a fast full text search engine that supports all languages.
+--   3 | PGroonga is a PostgreSQL extension that uses Groonga as index.
+--   4 | There is groonga command.
+-- (3 rows)
 ```
 
-Normally, the default configuration returns better result for full text search rather than the original `LIKE` operator. Think about which result is better for users before you change the default configuration.
+## See also
+
+  * [`CREATE INDEX USING pgroonga`](../create-index-using-pgroonga.html)
 
-See [Customization in `CREATE INDEX USING pgroonga`](../create-index-using-pgroonga.html#customization) for tokenizer and normalizer.
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index