Kouhei Sutou
null+****@clear*****
Sun Oct 25 22:02:07 JST 2015
Kouhei Sutou 2015-10-25 22:02:07 +0900 (Sun, 25 Oct 2015) New Revision: b6e5cdfd4e0a81d0e23773215c65b91770da8668 https://github.com/pgroonga/pgroonga.github.io/commit/b6e5cdfd4e0a81d0e23773215c65b91770da8668 Message: Use English for sample data Modified files: _po/ja/reference/operators/like.po ja/reference/operators/like.md reference/operators/like.md Modified: _po/ja/reference/operators/like.po (+69 -20) =================================================================== --- _po/ja/reference/operators/like.po 2015-10-25 21:55:44 +0900 (f625c2c) +++ _po/ja/reference/operators/like.po 2015-10-25 22:02:07 +0900 (4237b23) @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2015-10-24 17:43+0900\n" +"PO-Revision-Date: 2015-10-25 22:00+0900\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -52,6 +52,41 @@ msgid "" "IKE` operator with index searches with case insensitive." msgstr "たとえば、元の`LIKE`演算子は大文字小文字を区別して検索します。しかし、インデックスを使った`LIKE`演算子は大文字小文字を区別しません。" +msgid "Here are sample schema and data:" +msgstr "" + +msgid "" +"```sql\n" +"CREATE TABLE memos (\n" +" id integer,\n" +" content text\n" +");" +msgstr "" + +msgid "" +"CREATE INDEX pgroonga_content_index ON memos USING pgroonga (content);\n" +"```" +msgstr "" + +msgid "" +"```sql\n" +"INSERT INTO memos VALUES (1, 'PostgreSQL is a relational database management s" +"ystem.');\n" +"INSERT INTO memos VALUES (2, 'Groonga is a fast full text search engine that s" +"upports all languages.');\n" +"INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Gro" +"onga as index.');\n" +"INSERT INTO memos VALUES (4, 'There is groonga command.');\n" +"```" +msgstr "" +"```sql\n" +"INSERT INTO memos VALUES (1, 'PostgreSQLはリレーショナル・データベース管理システムです。');\n" +"INSERT INTO memos VALUES (2, 'Groongaは日本語対応の高速な全文検索エンジンです。');\n" +"INSERT INTO memos VALUES (3, 'PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です" +"。');\n" +"INSERT INTO memos VALUES (4, 'groongaコマンドがあります。');\n" +"```" + msgid "A search result of the original `LIKE` operator:" msgstr "元の`LIKE`演算子の結果です。" @@ -59,14 +94,23 @@ msgid "" "```sql\n" "SET enable_seqscan = on;\n" "SET enable_indexscan = off;\n" -"SET enable_bitmapscan = off;\n" +"SET enable_bitmapscan = off;" +msgstr "" + +msgid "" +"SELECT * FROM memos WHERE content LIKE '%groonga%';\n" +"-- id | content \n" +"-- ----+---------------------------\n" +"-- 4 | There is groonga command.\n" +"-- (1 row)\n" +"```" +msgstr "" "SELECT * FROM memos WHERE content LIKE '%groonga%';\n" "-- id | content \n" "-- ----+-----------------------------\n" "-- 4 | groongaコマンドがあります。\n" -"-- (1 行)\n" +"-- (1 row)\n" "```" -msgstr "" msgid "A search result of `LIKE` operator with index:" msgstr "インデックスを使った`LIKE`演算子の結果です。" @@ -75,7 +119,22 @@ msgid "" "```sql\n" "SET enable_seqscan = off;\n" "SET enable_indexscan = on;\n" -"SET enable_bitmapscan = on;\n" +"SET enable_bitmapscan = on;" +msgstr "" + +msgid "" +"SELECT * FROM memos WHERE content LIKE '%groonga%';\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" +"-- 4 | There is groonga command.\n" +"-- (3 rows)\n" +"```" +msgstr "" "SELECT * FROM memos WHERE content LIKE '%groonga%';\n" "-- id | content " " \n" @@ -84,9 +143,8 @@ msgid "" "-- 2 | Groongaは日本語対応の高速な全文検索エンジンです。\n" "-- 3 | PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。\n" "-- 4 | groongaコマンドがあります。\n" -"-- (3 行)\n" +"-- (3 rows)\n" "```" -msgstr "" msgid "" "If you want to get the same result by both `LIKE` operator with index and the " @@ -105,6 +163,10 @@ msgstr "具体例は次の通りです。" msgid "" "```sql\n" +"DROP INDEX IF EXISTS pgroonga_content_index;" +msgstr "" + +msgid "" "CREATE INDEX pgroonga_content_index\n" " ON memos\n" " USING pgroonga (content)\n" @@ -119,19 +181,6 @@ msgid "" msgstr "元の`LIKE`演算子とインデックスを使った`LIKE`演算子で同じ結果が返ります。" msgid "" -"```sql\n" -"SET enable_seqscan = off;\n" -"SET enable_indexscan = on;\n" -"SET enable_bitmapscan = on;\n" -"SELECT * FROM memos WHERE content LIKE '%groonga%';\n" -"-- id | content \n" -"-- ----+-----------------------------\n" -"-- 4 | groongaコマンドがあります。\n" -"-- (1 行)\n" -"```" -msgstr "" - -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." Modified: ja/reference/operators/like.md (+26 -3) =================================================================== --- ja/reference/operators/like.md 2015-10-25 21:55:44 +0900 (42eef2e) +++ ja/reference/operators/like.md 2015-10-25 22:02:07 +0900 (873ce81) @@ -13,17 +13,36 @@ PGroongaは内部的に`column LIKE '%キーワード%'`条件を`column %% 'キ たとえば、元の`LIKE`演算子は大文字小文字を区別して検索します。しかし、インデックスを使った`LIKE`演算子は大文字小文字を区別しません。 +Here are sample schema and data: + +```sql +CREATE TABLE memos ( + id integer, + content text +); + +CREATE INDEX pgroonga_content_index ON memos USING pgroonga (content); +``` + +```sql +INSERT INTO memos VALUES (1, 'PostgreSQLはリレーショナル・データベース管理システムです。'); +INSERT INTO memos VALUES (2, 'Groongaは日本語対応の高速な全文検索エンジンです。'); +INSERT INTO memos VALUES (3, 'PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。'); +INSERT INTO memos VALUES (4, 'groongaコマンドがあります。'); +``` + 元の`LIKE`演算子の結果です。 ```sql SET enable_seqscan = on; SET enable_indexscan = off; SET enable_bitmapscan = off; + SELECT * FROM memos WHERE content LIKE '%groonga%'; -- id | content -- ----+----------------------------- -- 4 | groongaコマンドがあります。 --- (1 行) +-- (1 row) ``` インデックスを使った`LIKE`演算子の結果です。 @@ -32,13 +51,14 @@ SELECT * FROM memos WHERE content LIKE '%groonga%'; SET enable_seqscan = off; SET enable_indexscan = on; SET enable_bitmapscan = on; + SELECT * FROM memos WHERE content LIKE '%groonga%'; -- id | content -- ----+--------------------------------------------------------------------------- -- 2 | Groongaは日本語対応の高速な全文検索エンジンです。 -- 3 | PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。 -- 4 | groongaコマンドがあります。 --- (3 行) +-- (3 rows) ``` インデックスを使った`LIKE`演算子の結果と元の`LIKE`演算子の結果を同じにしたい場合は次のトークナイザーとノーマライザーを使います。 @@ -49,6 +69,8 @@ SELECT * FROM memos WHERE content LIKE '%groonga%'; 具体例は次の通りです。 ```sql +DROP INDEX IF EXISTS pgroonga_content_index; + CREATE INDEX pgroonga_content_index ON memos USING pgroonga (content) @@ -62,11 +84,12 @@ CREATE INDEX pgroonga_content_index SET enable_seqscan = off; SET enable_indexscan = on; SET enable_bitmapscan = on; + SELECT * FROM memos WHERE content LIKE '%groonga%'; -- id | content -- ----+----------------------------- -- 4 | groongaコマンドがあります。 --- (1 行) +-- (1 row) ``` 通常、デフォルトの設定は元の`LIKE`演算子よりも適切な全文検索結果を返す設定です。もし、デフォルトの設定をするときは、変更する前にユーザーにとてどのような結果が適切かを考えてください。 Modified: reference/operators/like.md (+37 -14) =================================================================== --- reference/operators/like.md 2015-10-25 21:55:44 +0900 (f25a9b9) +++ reference/operators/like.md 2015-10-25 22:02:07 +0900 (0011c99) @@ -13,17 +13,36 @@ The original `LIKE` operator searches against text as is. But `%%` operator does For example, the original `LIKE` operator searches with case sensitive. But `LIKE` operator with index searches with case insensitive. +Here are sample schema and data: + +```sql +CREATE TABLE memos ( + id integer, + content text +); + +CREATE INDEX pgroonga_content_index ON memos USING pgroonga (content); +``` + +```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.'); +``` + A search result of the original `LIKE` operator: ```sql SET enable_seqscan = on; SET enable_indexscan = off; SET enable_bitmapscan = off; + SELECT * FROM memos WHERE content LIKE '%groonga%'; --- id | content --- ----+----------------------------- --- 4 | groongaコマンドがあります。 --- (1 行) +-- id | content +-- ----+--------------------------- +-- 4 | There is groonga command. +-- (1 row) ``` A search result of `LIKE` operator with index: @@ -32,13 +51,14 @@ A search result of `LIKE` operator with index: SET enable_seqscan = off; SET enable_indexscan = on; SET enable_bitmapscan = on; + SELECT * FROM memos WHERE content LIKE '%groonga%'; --- id | content --- ----+--------------------------------------------------------------------------- --- 2 | Groongaは日本語対応の高速な全文検索エンジンです。 --- 3 | PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。 --- 4 | groongaコマンドがあります。 --- (3 行) +-- 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) ``` 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: @@ -49,6 +69,8 @@ If you want to get the same result by both `LIKE` operator with index and the or Here is a concrete example: ```sql +DROP INDEX IF EXISTS pgroonga_content_index; + CREATE INDEX pgroonga_content_index ON memos USING pgroonga (content) @@ -62,11 +84,12 @@ You can get the same result as the original `LIKE` operator with `LIKE` operator SET enable_seqscan = off; SET enable_indexscan = on; SET enable_bitmapscan = on; + SELECT * FROM memos WHERE content LIKE '%groonga%'; --- id | content --- ----+----------------------------- --- 4 | groongaコマンドがあります。 --- (1 行) +-- id | content +-- ----+--------------------------- +-- 4 | There is groonga command. +-- (1 row) ``` 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. -------------- next part -------------- HTML����������������������������...Download