Kouhei Sutou
null+****@clear*****
Sat Oct 24 15:58:44 JST 2015
Kouhei Sutou 2015-10-24 15:58:44 +0900 (Sat, 24 Oct 2015) New Revision: 65faecb3cc315d49db7603e5bef668a936d1377d https://github.com/pgroonga/pgroonga.github.io/commit/65faecb3cc315d49db7603e5bef668a936d1377d Message: Translate pgroonga.command Added files: _po/ja/reference/functions/pgroonga-command.po ja/reference/functions/pgroonga-command.md Added: _po/ja/reference/functions/pgroonga-command.po (+196 -0) 100644 =================================================================== --- /dev/null +++ _po/ja/reference/functions/pgroonga-command.po 2015-10-24 15:58:44 +0900 (e369d33) @@ -0,0 +1,196 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2015-10-24 15:46+0900\n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "" +"---\n" +"title: pgroonga.command function\n" +"layout: en\n" +"---" +msgstr "" +"---\n" +"title: pgroonga.command関数\n" +"layout: ja\n" +"---" + +msgid "# `pgroonga.command` function" +msgstr "# `pgroonga.command`関数" + +msgid "## Summary" +msgstr "## 概要" + +msgid "" +"`pgroonga.command` function executes a [Groonga command](http://groonga.org/do" +"cs/reference/command.html) and returns the result as `text` type value." +msgstr "" +"`pgroonga.command`関数は[Groongaのコマンド](http://groonga.org/ja/docs/reference/comma" +"nd.html)を実行して`text`型の値として結果を返します。" + +msgid "## Syntax" +msgstr "## 構文" + +msgid "Here is the syntax of this function:" +msgstr "この関数の構文は次の通りです。" + +msgid "" +"```text\n" +"text pgroonga.command(command)\n" +"```" +msgstr "" + +msgid "" +"`command` is a `text` type value. `pgroonga.command` executes `command` as a G" +"roonga command." +msgstr "`command`は`text`型の値です。`pgroonga.command`は`command`をGroongaのコマンドとして実行します。" + +msgid "" +"Groonga command returns result as JSON. `pgroonga.command` returns the JSON as" +" `text` type value. You can use [JSON functions and operations provided by Pos" +"tgreSQL](http://www.postgresql.org/docs/current/static/functions-json.html) by" +" casting the result to `json` or `jsonb` type." +msgstr "" +"Groongaのコマンドは結果をJSONとして返します。`pgroonga.command`はJSONを`text`型の値として返します。結果を`json`" +"型か`jsonb`型にキャストすると[PostgreSQLが提供するJSON関数・演算](http://www.postgresql.org/docs/cu" +"rrent/static/functions-json.html)を使うことができます。" + +msgid "## Usage" +msgstr "## 使い方" + +msgid "See [examples in tutorial](../../tutorial/#groonga)." +msgstr "[チュートリアルの例](../../tutorial/#groonga)も参照してください。" + +msgid "{: #attention}" +msgstr "" + +msgid "## Attention for `select` Groonga command" +msgstr "## Groongaの`select`コマンドに関する注意事項" + +msgid "" +"You need to take care about invalid records when you use [`select` Groonga com" +"mand](http://groonga.org/docs/reference/commands/select.html)." +msgstr "" +"[Groongaの`select`コマンド](http://groonga.org/ja/docs/reference/commands/select.ht" +"ml)を使うとき、不正なレコードについて注意する必要があります。" + +msgid "" +"You may get invalid records when PGroonga index target table processed one or " +"more `DELETE` or `UPDATE` after last `VACUUM`. There are deleted and/or old re" +"cords exist in Groonga table for the case. If there are deleted or old records" +", `select` Groonga command may return them." +msgstr "" +"最後の`VACUUM`のあと、PGroongaのインデックス対象のテーブルに対して1回以上`DELETE`または`UPDATE`が発生すると不正なレコードが" +"返ることがあります。この状態のとき、Groongaのテーブルには削除されたレコードまたは古いレコードが存在します。Groongaの`select`コマンドは" +"これらの削除されたレコード・古いレコードを返すことがあります。" + +msgid "The followings show this case by example." +msgstr "このケースを例で説明します。" + +msgid "Here is the result before updating. There are 3 records:" +msgstr "以下は更新前の結果です。3レコードあります。" + +msgid "" +"```sql\n" +"SELECT *\n" +" FROM json_array_elements(\n" +" pgroonga.command('select ' ||\n" +" pgroonga.table_name('pgroonga_terms_index')\n" +" )::json->1->0);\n" +"-- value " +" \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" +"```" +msgstr "" + +msgid "Update 1 record:" +msgstr "1つのレコードを更新します。" + +msgid "" +"```sql\n" +"UPDATE terms\n" +" SET title = 'Mroonga',\n" +" content = 'MroongaはGroongaをバックエンドにしたMySQLのストレージエンジンです。',\n" +" tag = 'MySQL'\n" +" WHERE id = 3;\n" +"```" +msgstr "" + +msgid "" +"Executes `select` Groonga command again. It returns 4 records. 1 record is add" +"ed because there is the record before updating:" +msgstr "Groongaの`select`コマンドを再度実行します。4レコード返ります。1レコード増えています。これは、更新前のレコードが残っているからです。" + +msgid "" +"```sql\n" +"SELECT *\n" +" FROM json_array_elements(\n" +" pgroonga.command('select ' ||\n" +" pgroonga.table_name('pgroonga_terms_index')\n" +" )::json->1->0);\n" +"-- value " +" \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" +"```" +msgstr "" + +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:" +msgstr "" +"明示的に`VACUUM`を実行します。その後、Groongaの`select`コマンドを再度実行します。3レコード返ってきます。ここには古いレコードはありま" +"せん。" + +msgid "" +"```sql\n" +"VACUUM;\n" +"SELECT *\n" +" FROM json_array_elements(\n" +" pgroonga.command('select ' ||\n" +" pgroonga.table_name('pgroonga_terms_index')\n" +" )::json->1->0);\n" +"-- value " +" \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" +"```" +msgstr "" + +msgid "## See also" +msgstr "## 参考" + +msgid " * [Examples in tutorial](../../tutorial/#groonga)" +msgstr " * [チュートリアルにある例](../../tutorial/#groonga)" Added: ja/reference/functions/pgroonga-command.md (+108 -0) 100644 =================================================================== --- /dev/null +++ ja/reference/functions/pgroonga-command.md 2015-10-24 15:58:44 +0900 (d86d347) @@ -0,0 +1,108 @@ +--- +title: pgroonga.command関数 +layout: ja +--- + +# `pgroonga.command`関数 + +## 概要 + +`pgroonga.command`関数は[Groongaのコマンド](http://groonga.org/ja/docs/reference/command.html)を実行して`text`型の値として結果を返します。 + +## 構文 + +この関数の構文は次の通りです。 + +```text +text pgroonga.command(command) +``` + +`command`は`text`型の値です。`pgroonga.command`は`command`をGroongaのコマンドとして実行します。 + +Groongaのコマンドは結果をJSONとして返します。`pgroonga.command`はJSONを`text`型の値として返します。結果を`json`型か`jsonb`型にキャストすると[PostgreSQLが提供するJSON関数・演算](http://www.postgresql.org/docs/current/static/functions-json.html)を使うことができます。 + +## 使い方 + +[チュートリアルの例](../../tutorial/#groonga)も参照してください。 + +{: #attention} + +## Groongaの`select`コマンドに関する注意事項 + +[Groongaの`select`コマンド](http://groonga.org/ja/docs/reference/commands/select.html)を使うとき、不正なレコードについて注意する必要があります。 + +最後の`VACUUM`のあと、PGroongaのインデックス対象のテーブルに対して1回以上`DELETE`または`UPDATE`が発生すると不正なレコードが返ることがあります。この状態のとき、Groongaのテーブルには削除されたレコードまたは古いレコードが存在します。Groongaの`select`コマンドはこれらの削除されたレコード・古いレコードを返すことがあります。 + +このケースを例で説明します。 + +以下は更新前の結果です。3レコードあります。 + +```sql +SELECT * + FROM json_array_elements( + pgroonga.command('select ' || + pgroonga.table_name('pgroonga_terms_index') + )::json->1->0); +-- 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 行) +``` + +1つのレコードを更新します。 + +```sql +UPDATE terms + SET title = 'Mroonga', + content = 'MroongaはGroongaをバックエンドにしたMySQLのストレージエンジンです。', + tag = 'MySQL' + WHERE id = 3; +``` + +Groongaの`select`コマンドを再度実行します。4レコード返ります。1レコード増えています。これは、更新前のレコードが残っているからです。 + +```sql +SELECT * + FROM json_array_elements( + pgroonga.command('select ' || + pgroonga.table_name('pgroonga_terms_index') + )::json->1->0); +-- 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 行) +``` + +古いレコードは`VACUUM`実行時に削除されます。 + +明示的に`VACUUM`を実行します。その後、Groongaの`select`コマンドを再度実行します。3レコード返ってきます。ここには古いレコードはありません。 + +```sql +VACUUM; +SELECT * + FROM json_array_elements( + pgroonga.command('select ' || + pgroonga.table_name('pgroonga_terms_index') + )::json->1->0); +-- 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 行) +``` + +## 参考 + + * [チュートリアルにある例](../../tutorial/#groonga) -------------- next part -------------- HTML����������������������������... Download