Kouhei Sutou
null+****@clear*****
Sun Oct 25 21:50:21 JST 2015
Kouhei Sutou 2015-10-25 21:50:21 +0900 (Sun, 25 Oct 2015) New Revision: c4dfa9c1ae06998db805d53959b606fad3988e1c https://github.com/pgroonga/pgroonga.github.io/commit/c4dfa9c1ae06998db805d53959b606fad3988e1c Message: Use English for sample data Modified files: _po/ja/reference/functions/pgroonga-command.po ja/reference/functions/pgroonga-command.md reference/functions/pgroonga-command.md Modified: _po/ja/reference/functions/pgroonga-command.po (+78 -42) =================================================================== --- _po/ja/reference/functions/pgroonga-command.po 2015-10-25 21:34:05 +0900 (4ed43e7) +++ _po/ja/reference/functions/pgroonga-command.po 2015-10-25 21:50:21 +0900 (163fa53) @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2015-10-25 21:03+0900\n" +"PO-Revision-Date: 2015-10-25 21:49+0900\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -91,6 +91,34 @@ msgstr "" msgid "The followings show this case by example." msgstr "このケースを例で説明します。" +msgid "Here are sample schema and data for examples:" +msgstr "例に使うサンプルスキーマとデータは次の通りです。" + +msgid "" +"```sql\n" +"CREATE TABLE posts (\n" +" id integer PRIMARY KEY,\n" +" title text,\n" +" content text\n" +");" +msgstr "" + +msgid "" +"CREATE INDEX pgroonga_posts_index\n" +" ON posts\n" +" USING pgroonga (id, title, content);" +msgstr "" + +msgid "" +"INSERT INTO posts VALUES (1, 'PostgreSQL', 'PostgreSQL is a relational databas" +"e management system.');\n" +"INSERT INTO posts VALUES (2, 'Groonga', 'Groonga is a fast full text search en" +"gine that supports all languages.');\n" +"INSERT INTO posts VALUES (3, 'PGroonga', 'PGroonga is a PostgreSQL extension t" +"hat uses Groonga as index.');\n" +"```" +msgstr "" + msgid "Here is the result before updating. There are 3 records:" msgstr "以下は更新前の結果です。3レコードあります。" @@ -99,20 +127,22 @@ msgid "" "SELECT *\n" " FROM json_array_elements(\n" " pgroonga.command('select ' ||\n" -" pgroonga.table_name('pgroonga_terms_index')\n" +" pgroonga.table_name('pgroonga_posts_index')\n" " )::json->1->0);\n" -"-- value " -" \n" +"-- value " +" \n" "-- ---------------------------------------------------------------------------" -"--------------------------------\n" +"----------------------\n" "-- [3]\n" -"-- [[\"_id\",\"UInt32\"],[\"_key\",\"UInt64\"],[\"content\",\"LongText\"],[\"tag\",\"ShortTe" -"xt\"],[\"title\",\"LongText\"]]\n" -"-- [1,1,\"PostgreSQLはリレーショナル・データベース管理システムです。\",\"PostgreSQL\",\"PostgreSQL\"]\n" -"-- [2,2,\"Groongaは日本語対応の高速な全文検索エンジンです。\",\"Groonga\",\"Groonga\"]\n" -"-- [3,3,\"PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。\",\"PostgreSQL\",\"PGr" -"oonga\"]\n" -"-- (5 行)\n" +"-- [[\"_id\",\"UInt32\"],[\"content\",\"LongText\"],[\"ctid\",\"UInt64\"],[\"id\",\"Int32\"]," +"[\"title\",\"LongText\"]]\n" +"-- [1,\"PostgreSQL is a relational database management system.\",1,1,\"PostgreSQ" +"L\"]\n" +"-- [2,\"Groonga is a fast full text search engine that supports all languages." +"\",2,2,\"Groonga\"]\n" +"-- [3,\"PGroonga is a PostgreSQL extension that uses Groonga as index.\",3,3,\"P" +"Groonga\"]\n" +"-- (5 rows)\n" "```" msgstr "" @@ -121,10 +151,10 @@ msgstr "1つのレコードを更新します。" msgid "" "```sql\n" -"UPDATE terms\n" +"UPDATE posts\n" " SET title = 'Mroonga',\n" -" content = 'MroongaはGroongaをバックエンドにしたMySQLのストレージエンジンです。',\n" -" tag = 'MySQL'\n" +" content = 'Mroonga is a MySQL storage engine that uses Groonga as backe" +"nd.'\n" " WHERE id = 3;\n" "```" msgstr "" @@ -139,21 +169,24 @@ msgid "" "SELECT *\n" " FROM json_array_elements(\n" " pgroonga.command('select ' ||\n" -" pgroonga.table_name('pgroonga_terms_index')\n" +" pgroonga.table_name('pgroonga_posts_index')\n" " )::json->1->0);\n" -"-- value " -" \n" +"-- value " +" \n" "-- ---------------------------------------------------------------------------" -"--------------------------------\n" +"----------------------\n" "-- [4]\n" -"-- [[\"_id\",\"UInt32\"],[\"_key\",\"UInt64\"],[\"content\",\"LongText\"],[\"tag\",\"ShortTe" -"xt\"],[\"title\",\"LongText\"]]\n" -"-- [1,1,\"PostgreSQLはリレーショナル・データベース管理システムです。\",\"PostgreSQL\",\"PostgreSQL\"]\n" -"-- [2,2,\"Groongaは日本語対応の高速な全文検索エンジンです。\",\"Groonga\",\"Groonga\"]\n" -"-- [3,3,\"PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。\",\"PostgreSQL\",\"PGr" -"oonga\"]\n" -"-- [4,4,\"MroongaはGroongaをバックエンドにしたMySQLのストレージエンジンです。\",\"MySQL\",\"Mroonga\"]\n" -"-- (6 行)\n" +"-- [[\"_id\",\"UInt32\"],[\"content\",\"LongText\"],[\"ctid\",\"UInt64\"],[\"id\",\"Int32\"]," +"[\"title\",\"LongText\"]]\n" +"-- [1,\"PostgreSQL is a relational database management system.\",1,1,\"PostgreSQ" +"L\"]\n" +"-- [2,\"Groonga is a fast full text search engine that supports all languages." +"\",2,2,\"Groonga\"]\n" +"-- [3,\"PGroonga is a PostgreSQL extension that uses Groonga as index.\",3,3,\"P" +"Groonga\"]\n" +"-- [4,\"Mroonga is a MySQL storage engine that uses Groonga as backend.\",4,3,\"" +"Mroonga\"]\n" +"-- (6 rows)\n" "```" msgstr "" @@ -161,31 +194,34 @@ msgid "The old record is deleted when `VACUUM` is executed." msgstr "古いレコードは`VACUUM`実行時に削除されます。" msgid "" -"Execute `VACUUM` explicitly. And then execute `select` Groonga command again. " -"It returns 3 records. There isn't the old record:" +"Execute `VACUUM FULL` explicitly. And then execute `select` Groonga command ag" +"ain. It returns 3 records. There isn't the old record:" msgstr "" -"明示的に`VACUUM`を実行します。その後、Groongaの`select`コマンドを再度実行します。3レコード返ってきます。ここには古いレコードはありま" -"せん。" +"明示的に`VACUUM FULL`を実行します。その後、Groongaの`select`コマンドを再度実行します。3レコード返ってきます。ここには古いレコー" +"ドはありません。" msgid "" "```sql\n" -"VACUUM;\n" +"VACUUM FULL;\n" "SELECT *\n" " FROM json_array_elements(\n" " pgroonga.command('select ' ||\n" -" pgroonga.table_name('pgroonga_terms_index')\n" +" pgroonga.table_name('pgroonga_posts_index')\n" " )::json->1->0);\n" -"-- value " -" \n" +"-- value " +" \n" "-- ---------------------------------------------------------------------------" -"---------------------------\n" +"----------------------\n" "-- [3]\n" -"-- [[\"_id\",\"UInt32\"],[\"_key\",\"UInt64\"],[\"content\",\"LongText\"],[\"tag\",\"ShortTe" -"xt\"],[\"title\",\"LongText\"]]\n" -"-- [1,1,\"PostgreSQLはリレーショナル・データベース管理システムです。\",\"PostgreSQL\",\"PostgreSQL\"]\n" -"-- [2,2,\"Groongaは日本語対応の高速な全文検索エンジンです。\",\"Groonga\",\"Groonga\"]\n" -"-- [4,4,\"MroongaはGroongaをバックエンドにしたMySQLのストレージエンジンです。\",\"MySQL\",\"Mroonga\"]\n" -"-- (5 行)\n" +"-- [[\"_id\",\"UInt32\"],[\"content\",\"LongText\"],[\"ctid\",\"UInt64\"],[\"id\",\"Int32\"]," +"[\"title\",\"LongText\"]]\n" +"-- [1,\"PostgreSQL is a relational database management system.\",1,1,\"PostgreSQ" +"L\"]\n" +"-- [2,\"Groonga is a fast full text search engine that supports all languages." +"\",2,2,\"Groonga\"]\n" +"-- [3,\"Mroonga is a MySQL storage engine that uses Groonga as backend.\",3,3,\"" +"Mroonga\"]\n" +"-- (5 rows)\n" "```" msgstr "" Modified: ja/reference/functions/pgroonga-command.md (+47 -30) =================================================================== --- ja/reference/functions/pgroonga-command.md 2015-10-25 21:34:05 +0900 (ed76498) +++ ja/reference/functions/pgroonga-command.md 2015-10-25 21:50:21 +0900 (1cb5805) @@ -35,31 +35,48 @@ Groongaのコマンドは結果をJSONとして返します。`pgroonga.command` このケースを例で説明します。 +例に使うサンプルスキーマとデータは次の通りです。 + +```sql +CREATE TABLE posts ( + id integer PRIMARY KEY, + title text, + content text +); + +CREATE INDEX pgroonga_posts_index + ON posts + USING pgroonga (id, title, content); + +INSERT INTO posts VALUES (1, 'PostgreSQL', 'PostgreSQL is a relational database management system.'); +INSERT INTO posts VALUES (2, 'Groonga', 'Groonga is a fast full text search engine that supports all languages.'); +INSERT INTO posts VALUES (3, 'PGroonga', 'PGroonga is a PostgreSQL extension that uses Groonga as index.'); +``` + 以下は更新前の結果です。3レコードあります。 ```sql SELECT * FROM json_array_elements( pgroonga.command('select ' || - pgroonga.table_name('pgroonga_terms_index') + pgroonga.table_name('pgroonga_posts_index') )::json->1->0); --- value --- ----------------------------------------------------------------------------------------------------------- +-- value +-- ------------------------------------------------------------------------------------------------- -- [3] --- [["_id","UInt32"],["_key","UInt64"],["content","LongText"],["tag","ShortText"],["title","LongText"]] --- [1,1,"PostgreSQLはリレーショナル・データベース管理システムです。","PostgreSQL","PostgreSQL"] --- [2,2,"Groongaは日本語対応の高速な全文検索エンジンです。","Groonga","Groonga"] --- [3,3,"PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。","PostgreSQL","PGroonga"] --- (5 行) +-- [["_id","UInt32"],["content","LongText"],["ctid","UInt64"],["id","Int32"],["title","LongText"]] +-- [1,"PostgreSQL is a relational database management system.",1,1,"PostgreSQL"] +-- [2,"Groonga is a fast full text search engine that supports all languages.",2,2,"Groonga"] +-- [3,"PGroonga is a PostgreSQL extension that uses Groonga as index.",3,3,"PGroonga"] +-- (5 rows) ``` 1つのレコードを更新します。 ```sql -UPDATE terms +UPDATE posts SET title = 'Mroonga', - content = 'MroongaはGroongaをバックエンドにしたMySQLのストレージエンジンです。', - tag = 'MySQL' + content = 'Mroonga is a MySQL storage engine that uses Groonga as backend.' WHERE id = 3; ``` @@ -69,38 +86,38 @@ Groongaの`select`コマンドを再度実行します。4レコード返りま SELECT * FROM json_array_elements( pgroonga.command('select ' || - pgroonga.table_name('pgroonga_terms_index') + pgroonga.table_name('pgroonga_posts_index') )::json->1->0); --- value --- ----------------------------------------------------------------------------------------------------------- +-- value +-- ------------------------------------------------------------------------------------------------- -- [4] --- [["_id","UInt32"],["_key","UInt64"],["content","LongText"],["tag","ShortText"],["title","LongText"]] --- [1,1,"PostgreSQLはリレーショナル・データベース管理システムです。","PostgreSQL","PostgreSQL"] --- [2,2,"Groongaは日本語対応の高速な全文検索エンジンです。","Groonga","Groonga"] --- [3,3,"PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。","PostgreSQL","PGroonga"] --- [4,4,"MroongaはGroongaをバックエンドにしたMySQLのストレージエンジンです。","MySQL","Mroonga"] --- (6 行) +-- [["_id","UInt32"],["content","LongText"],["ctid","UInt64"],["id","Int32"],["title","LongText"]] +-- [1,"PostgreSQL is a relational database management system.",1,1,"PostgreSQL"] +-- [2,"Groonga is a fast full text search engine that supports all languages.",2,2,"Groonga"] +-- [3,"PGroonga is a PostgreSQL extension that uses Groonga as index.",3,3,"PGroonga"] +-- [4,"Mroonga is a MySQL storage engine that uses Groonga as backend.",4,3,"Mroonga"] +-- (6 rows) ``` 古いレコードは`VACUUM`実行時に削除されます。 -明示的に`VACUUM`を実行します。その後、Groongaの`select`コマンドを再度実行します。3レコード返ってきます。ここには古いレコードはありません。 +明示的に`VACUUM FULL`を実行します。その後、Groongaの`select`コマンドを再度実行します。3レコード返ってきます。ここには古いレコードはありません。 ```sql -VACUUM; +VACUUM FULL; SELECT * FROM json_array_elements( pgroonga.command('select ' || - pgroonga.table_name('pgroonga_terms_index') + pgroonga.table_name('pgroonga_posts_index') )::json->1->0); --- value --- ------------------------------------------------------------------------------------------------------ +-- value +-- ------------------------------------------------------------------------------------------------- -- [3] --- [["_id","UInt32"],["_key","UInt64"],["content","LongText"],["tag","ShortText"],["title","LongText"]] --- [1,1,"PostgreSQLはリレーショナル・データベース管理システムです。","PostgreSQL","PostgreSQL"] --- [2,2,"Groongaは日本語対応の高速な全文検索エンジンです。","Groonga","Groonga"] --- [4,4,"MroongaはGroongaをバックエンドにしたMySQLのストレージエンジンです。","MySQL","Mroonga"] --- (5 行) +-- [["_id","UInt32"],["content","LongText"],["ctid","UInt64"],["id","Int32"],["title","LongText"]] +-- [1,"PostgreSQL is a relational database management system.",1,1,"PostgreSQL"] +-- [2,"Groonga is a fast full text search engine that supports all languages.",2,2,"Groonga"] +-- [3,"Mroonga is a MySQL storage engine that uses Groonga as backend.",3,3,"Mroonga"] +-- (5 rows) ``` ## 参考 Modified: reference/functions/pgroonga-command.md (+47 -30) =================================================================== --- reference/functions/pgroonga-command.md 2015-10-25 21:34:05 +0900 (50e717a) +++ reference/functions/pgroonga-command.md 2015-10-25 21:50:21 +0900 (b329d91) @@ -35,31 +35,48 @@ You may get invalid records when PGroonga index target table processed one or mo The followings show this case by example. +Here are sample schema and data for examples: + +```sql +CREATE TABLE posts ( + id integer PRIMARY KEY, + title text, + content text +); + +CREATE INDEX pgroonga_posts_index + ON posts + USING pgroonga (id, title, content); + +INSERT INTO posts VALUES (1, 'PostgreSQL', 'PostgreSQL is a relational database management system.'); +INSERT INTO posts VALUES (2, 'Groonga', 'Groonga is a fast full text search engine that supports all languages.'); +INSERT INTO posts VALUES (3, 'PGroonga', 'PGroonga is a PostgreSQL extension that uses Groonga as index.'); +``` + Here is the result before updating. There are 3 records: ```sql SELECT * FROM json_array_elements( pgroonga.command('select ' || - pgroonga.table_name('pgroonga_terms_index') + pgroonga.table_name('pgroonga_posts_index') )::json->1->0); --- value --- ----------------------------------------------------------------------------------------------------------- +-- value +-- ------------------------------------------------------------------------------------------------- -- [3] --- [["_id","UInt32"],["_key","UInt64"],["content","LongText"],["tag","ShortText"],["title","LongText"]] --- [1,1,"PostgreSQLはリレーショナル・データベース管理システムです。","PostgreSQL","PostgreSQL"] --- [2,2,"Groongaは日本語対応の高速な全文検索エンジンです。","Groonga","Groonga"] --- [3,3,"PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。","PostgreSQL","PGroonga"] --- (5 行) +-- [["_id","UInt32"],["content","LongText"],["ctid","UInt64"],["id","Int32"],["title","LongText"]] +-- [1,"PostgreSQL is a relational database management system.",1,1,"PostgreSQL"] +-- [2,"Groonga is a fast full text search engine that supports all languages.",2,2,"Groonga"] +-- [3,"PGroonga is a PostgreSQL extension that uses Groonga as index.",3,3,"PGroonga"] +-- (5 rows) ``` Update 1 record: ```sql -UPDATE terms +UPDATE posts SET title = 'Mroonga', - content = 'MroongaはGroongaをバックエンドにしたMySQLのストレージエンジンです。', - tag = 'MySQL' + content = 'Mroonga is a MySQL storage engine that uses Groonga as backend.' WHERE id = 3; ``` @@ -69,38 +86,38 @@ Executes `select` Groonga command again. It returns 4 records. 1 record is added SELECT * FROM json_array_elements( pgroonga.command('select ' || - pgroonga.table_name('pgroonga_terms_index') + pgroonga.table_name('pgroonga_posts_index') )::json->1->0); --- value --- ----------------------------------------------------------------------------------------------------------- +-- value +-- ------------------------------------------------------------------------------------------------- -- [4] --- [["_id","UInt32"],["_key","UInt64"],["content","LongText"],["tag","ShortText"],["title","LongText"]] --- [1,1,"PostgreSQLはリレーショナル・データベース管理システムです。","PostgreSQL","PostgreSQL"] --- [2,2,"Groongaは日本語対応の高速な全文検索エンジンです。","Groonga","Groonga"] --- [3,3,"PGroongaはインデックスとしてGroongaを使うためのPostgreSQLの拡張機能です。","PostgreSQL","PGroonga"] --- [4,4,"MroongaはGroongaをバックエンドにしたMySQLのストレージエンジンです。","MySQL","Mroonga"] --- (6 行) +-- [["_id","UInt32"],["content","LongText"],["ctid","UInt64"],["id","Int32"],["title","LongText"]] +-- [1,"PostgreSQL is a relational database management system.",1,1,"PostgreSQL"] +-- [2,"Groonga is a fast full text search engine that supports all languages.",2,2,"Groonga"] +-- [3,"PGroonga is a PostgreSQL extension that uses Groonga as index.",3,3,"PGroonga"] +-- [4,"Mroonga is a MySQL storage engine that uses Groonga as backend.",4,3,"Mroonga"] +-- (6 rows) ``` The old record is deleted when `VACUUM` is executed. -Execute `VACUUM` explicitly. And then execute `select` Groonga command again. It returns 3 records. There isn't the old record: +Execute `VACUUM FULL` explicitly. And then execute `select` Groonga command again. It returns 3 records. There isn't the old record: ```sql -VACUUM; +VACUUM FULL; SELECT * FROM json_array_elements( pgroonga.command('select ' || - pgroonga.table_name('pgroonga_terms_index') + pgroonga.table_name('pgroonga_posts_index') )::json->1->0); --- value --- ------------------------------------------------------------------------------------------------------ +-- value +-- ------------------------------------------------------------------------------------------------- -- [3] --- [["_id","UInt32"],["_key","UInt64"],["content","LongText"],["tag","ShortText"],["title","LongText"]] --- [1,1,"PostgreSQLはリレーショナル・データベース管理システムです。","PostgreSQL","PostgreSQL"] --- [2,2,"Groongaは日本語対応の高速な全文検索エンジンです。","Groonga","Groonga"] --- [4,4,"MroongaはGroongaをバックエンドにしたMySQLのストレージエンジンです。","MySQL","Mroonga"] --- (5 行) +-- [["_id","UInt32"],["content","LongText"],["ctid","UInt64"],["id","Int32"],["title","LongText"]] +-- [1,"PostgreSQL is a relational database management system.",1,1,"PostgreSQL"] +-- [2,"Groonga is a fast full text search engine that supports all languages.",2,2,"Groonga"] +-- [3,"Mroonga is a MySQL storage engine that uses Groonga as backend.",3,3,"Mroonga"] +-- (5 rows) ``` ## See also -------------- next part -------------- HTML����������������������������...Download