YUKI Hiroshi
null+****@clear*****
Tue Aug 19 11:52:14 JST 2014
YUKI Hiroshi 2014-08-19 11:52:14 +0900 (Tue, 19 Aug 2014) New Revision: 9062b2b7f220ba24b29551e335ba37a64f7d0b63 https://github.com/droonga/droonga.org/commit/9062b2b7f220ba24b29551e335ba37a64f7d0b63 Message: Update translations Modified files: _po/ja/tutorial/1.0.6/dump-restore/index.po _po/ja/tutorial/1.0.6/groonga/index.po ja/tutorial/1.0.6/dump-restore/index.md ja/tutorial/1.0.6/groonga/index.md Modified: _po/ja/tutorial/1.0.6/dump-restore/index.po (+9 -9) =================================================================== --- _po/ja/tutorial/1.0.6/dump-restore/index.po 2014-08-19 11:47:41 +0900 (84f7719) +++ _po/ja/tutorial/1.0.6/dump-restore/index.po 2014-08-19 11:52:14 +0900 (b77ae63) @@ -242,11 +242,11 @@ msgstr "もし順番にこのチュートリアルを読み進めているので msgid "" " # endpoint=\"http://192.168.0.10:10041\"\n" -" # curl \"${endpoint}/d/table_remove?name=Location\"\n" +" # curl \"$endpoint/d/table_remove?name=Location\"\n" " [[0,1406610703.2229023,0.0010793209075927734],true]\n" -" # curl \"${endpoint}/d/table_remove?name=Store\"\n" +" # curl \"$endpoint/d/table_remove?name=Store\"\n" " [[0,1406610708.2757723,0.006396293640136719],true]\n" -" # curl \"${endpoint}/d/table_remove?name=Term\"\n" +" # curl \"$endpoint/d/table_remove?name=Term\"\n" " [[0,1406610712.379644,0.00006723403930664062],true]" msgstr "" @@ -255,12 +255,12 @@ msgstr "これでクラスタは空になりました。確かめてみましょ msgid "" " # endpoint=\"http://192.168.0.10:10041\"\n" -" # curl \"${endpoint}/d/table_list\"\n" +" # curl \"$endpoint/d/table_list\"\n" " [[0,1406610804.1535122,0.0002875328063964844],[[[\"id\",\"UInt32\"],[\"name\",\"S" "hortText\"],[\"path\",\"ShortText\"],[\"flags\",\"ShortText\"],[\"domain\",\"ShortText\"],[" "\"range\",\"ShortText\"],[\"default_tokenizer\",\"ShortText\"],[\"normalizer\",\"ShortTex" "t\"]]]]\n" -" # curl \"${endpoint}/d/select?table=Store&output_columns=name&limit=10\"\n" +" # curl \"$endpoint/d/select?table=Store&output_columns=name&limit=10\"\n" " [[0,1401363465.610241,0],[[[null],[]]]]" msgstr "" @@ -303,7 +303,7 @@ msgid "Then the data is completely restored. Confirm it:" msgstr "これで、データが完全に復元されました。確かめてみましょう:" msgid "" -" # ${endpoint}/select?table=Store&output_columns=name&limit=10\"\n" +" # $endpoint/select?table=Store&output_columns=name&limit=10\"\n" " [[0,1401363556.0294158,0.0000762939453125],[[[40],[[\"name\",\"ShortText\"]],[" "\"1st Avenue & 75th St. - New York NY (W)\"],[\"76th & Second - New York NY (W)" "\"],[\"Herald Square- Macy's - New York NY\"],[\"Macy's 5th Floor - Herald Square " @@ -359,9 +359,9 @@ msgid "" " --update \\\n" " --replica-hosts=$host\n" " # endpoint=\"http://$host:10041\"\n" -" # curl \"${endpoint}/d/table_remove?name=Location\"\n" -" # curl \"${endpoint}/d/table_remove?name=Store\"\n" -" # curl \"${endpoint}/d/table_remove?name=Term\"" +" # curl \"$endpoint/d/table_remove?name=Location\"\n" +" # curl \"$endpoint/d/table_remove?name=Store\"\n" +" # curl \"$endpoint/d/table_remove?name=Term\"" msgstr "" msgid "" Modified: _po/ja/tutorial/1.0.6/groonga/index.po (+318 -56) =================================================================== --- _po/ja/tutorial/1.0.6/groonga/index.po 2014-08-19 11:47:41 +0900 (472489a) +++ _po/ja/tutorial/1.0.6/groonga/index.po 2014-08-19 11:52:14 +0900 (6a70e25) @@ -314,7 +314,7 @@ msgstr "" msgid "" "~~~\n" -"# curl \"http://192.168.0.10:10041/droonga/system/status\"\n" +"# curl \"http://192.168.0.10:10041/droonga/system/status\" | jq \".\"\n" "{\n" " \"nodes\": {\n" " \"192.168.0.10:10031/droonga\": {\n" @@ -337,7 +337,7 @@ msgstr "" msgid "" "~~~\n" -"# curl \"http://192.168.0.11:10041/droonga/system/status\"\n" +"# curl \"http://192.168.0.11:10041/droonga/system/status\" | jq \".\"\n" "{\n" " \"nodes\": {\n" " \"192.168.0.10:10031/droonga\": {\n" @@ -374,10 +374,19 @@ msgstr "" "新しいテーブル `Store` を作るには、`table_create` コマンドにあたるGETリクエストを送信して下さい:" msgid "" -" # endpoint=\"http://192.168.0.10:10041\"\n" -" # curl \"${endpoint}/d/table_create?name=Store&flags=TABLE_PAT_KEY&key_type" -"=ShortText\"\n" -" [[0,1401358896.360356,0.0035653114318847656],true]" +"~~~\n" +"# endpoint=\"http://192.168.0.10:10041\"\n" +"# curl \"$endpoint/d/table_create?name=Store&flags=TABLE_PAT_KEY&key_type=Short" +"Text\" | jq \".\"\n" +"[\n" +" [\n" +" 0,\n" +" 1401358896.360356,\n" +" 0.0035653114318847656\n" +" ],\n" +" true\n" +"]\n" +"~~~" msgstr "" msgid "" @@ -397,30 +406,76 @@ msgid "" msgstr "次は、`column_create` コマンドを使って `Store` テーブルに `name` と `location` という新しいカラムを作ります:" msgid "" -" # curl \"${endpoint}/d/column_create?table=Store&name=name&flags=COLUMN_SCA" -"LAR&type=ShortText\"\n" -" [[0,1401358348.6541538,0.0004096031188964844],true]\n" -" # curl \"${endpoint}/d/column_create?table=Store&name=location&flags=COLUMN" -"_SCALAR&type=WGS84GeoPoint\"\n" -" [[0,1401358359.084659,0.002511262893676758],true],true]" +"~~~\n" +"# curl \"$endpoint/d/column_create?table=Store&name=name&flags=COLUMN_SCALAR&ty" +"pe=ShortText\" | jq \".\"\n" +"[\n" +" [\n" +" 0,\n" +" 1401358348.6541538,\n" +" 0.0004096031188964844\n" +" ],\n" +" true\n" +"]\n" +"# curl \"$endpoint/d/column_create?table=Store&name=location&flags=COLUMN_SCALA" +"R&type=WGS84GeoPoint\" | jq \".\"\n" +"[\n" +" [\n" +" 0,\n" +" 1401358359.084659,\n" +" 0.002511262893676758\n" +" ],\n" +" true\n" +"]\n" +"~~~" msgstr "" msgid "Create indexes also." msgstr "インデックスも作成しましょう。" msgid "" -" # curl \"${endpoint}/d/table_create?name=Term&flags=TABLE_PAT_KEY&key_type=" -"ShortText&default_tokenizer=TokenBigram&normalizer=NormalizerAuto\"\n" -" [[0,1401358475.7229664,0.002419710159301758],true]\n" -" # curl \"${endpoint}/d/column_create?table=Term&name=store_name&flags=COLUM" -"N_INDEX|WITH_POSITION&type=Store&source=name\"\n" -" [[0,1401358494.1656318,0.006799221038818359],true]\n" -" # curl \"${endpoint}/d/table_create?name=Location&flags=TABLE_PAT_KEY&key_t" -"ype=WGS84GeoPoint\"\n" -" [[0,1401358505.708896,0.0016951560974121094],true]\n" -" # curl \"${endpoint}/d/column_create?table=Location&name=store&flags=COLUMN" -"_INDEX&type=Store&source=location\"\n" -" [[0,1401358519.6187897,0.024788379669189453],true]" +"~~~\n" +"# curl \"$endpoint/d/table_create?name=Term&flags=TABLE_PAT_KEY&key_type=ShortT" +"ext&default_tokenizer=TokenBigram&normalizer=NormalizerAuto\" | jq \".\"\n" +"[\n" +" [\n" +" 0,\n" +" 1401358475.7229664,\n" +" 0.002419710159301758\n" +" ],\n" +" true\n" +"]\n" +"# curl \"$endpoint/d/column_create?table=Term&name=store_name&flags=COLUMN_INDE" +"X|WITH_POSITION&type=Store&source=name\" | jq \".\"\n" +"[\n" +" [\n" +" 0,\n" +" 1401358494.1656318,\n" +" 0.006799221038818359\n" +" ],\n" +" true\n" +"]\n" +"# curl \"$endpoint/d/table_create?name=Location&flags=TABLE_PAT_KEY&key_type=WG" +"S84GeoPoint\" | jq \".\"\n" +"[\n" +" [\n" +" 0,\n" +" 1401358505.708896,\n" +" 0.0016951560974121094\n" +" ],\n" +" true\n" +"]\n" +"# curl \"$endpoint/d/column_create?table=Location&name=store&flags=COLUMN_INDEX" +"&type=Store&source=location\" | jq \".\"\n" +"[\n" +" [\n" +" 0,\n" +" 1401358519.6187897,\n" +" 0.024788379669189453\n" +" ],\n" +" true\n" +"]\n" +"~~~" msgstr "" msgid "" @@ -442,24 +497,124 @@ msgstr "" "`table_list` コマンドを使って、作成されたテーブルの情報を見てみましょう:" msgid "" -" # curl \"${endpoint}/d/table_list\"\n" -" [[0,1401358908.9126804,0.001600027084350586],[[[\"id\",\"UInt32\"],[\"name\",\"Sh" -"ortText\"],[\"path\",\"ShortText\"],[\"flags\",\"ShortText\"],[\"domain\",\"ShortText\"],[\"" -"range\",\"ShortText\"],[\"default_tokenizer\",\"ShortText\"],[\"normalizer\",\"ShortText" -"\"]],[256,\"Store\",\"/home/vagrant/droonga/000/db.0000100\",\"TABLE_PAT_KEY|PERSIST" -"ENT\",\"ShortText\",null,null,null]]]" +"~~~\n" +"# curl \"$endpoint/d/table_list\" | jq \".\"\n" +"[\n" +" [\n" +" 0,\n" +" 1401358908.9126804,\n" +" 0.001600027084350586\n" +" ],\n" +" [\n" +" [\n" +" [\n" +" \"id\",\n" +" \"UInt32\"\n" +" ],\n" +" [\n" +" \"name\",\n" +" \"ShortText\"\n" +" ],\n" +" [\n" +" \"path\",\n" +" \"ShortText\"\n" +" ],\n" +" [\n" +" \"flags\",\n" +" \"ShortText\"\n" +" ],\n" +" [\n" +" \"domain\",\n" +" \"ShortText\"\n" +" ],\n" +" [\n" +" \"range\",\n" +" \"ShortText\"\n" +" ],\n" +" [\n" +" \"default_tokenizer\",\n" +" \"ShortText\"\n" +" ],\n" +" [\n" +" \"normalizer\",\n" +" \"ShortText\"\n" +" ]\n" +" ],\n" +" [\n" +" 256,\n" +" \"Store\",\n" +" \"/home/vagrant/droonga/000/db.0000100\",\n" +" \"TABLE_PAT_KEY|PERSISTENT\",\n" +" \"ShortText\",\n" +" null,\n" +" null,\n" +" null\n" +" ]\n" +" ]\n" +"]\n" +"~~~" msgstr "" msgid "Because it is a cluster, another endpoint returns same result." msgstr "Droongaはクラスタで動作するので、他のエンドポイントも同じ結果を返します。" msgid "" -" # curl \"http://192.168.0.11:10041/d/table_list\"\n" -" [[0,1401358908.9126804,0.001600027084350586],[[[\"id\",\"UInt32\"],[\"name\",\"Sh" -"ortText\"],[\"path\",\"ShortText\"],[\"flags\",\"ShortText\"],[\"domain\",\"ShortText\"],[\"" -"range\",\"ShortText\"],[\"default_tokenizer\",\"ShortText\"],[\"normalizer\",\"ShortText" -"\"]],[256,\"Store\",\"/home/vagrant/droonga/000/db.0000100\",\"TABLE_PAT_KEY|PERSIST" -"ENT\",\"ShortText\",null,null,null]]]" +"~~~\n" +"# curl \"http://192.168.0.11:10041/d/table_list\" | jq \".\"\n" +"[\n" +" [\n" +" 0,\n" +" 1401358908.9126804,\n" +" 0.001600027084350586\n" +" ],\n" +" [\n" +" [\n" +" [\n" +" \"id\",\n" +" \"UInt32\"\n" +" ],\n" +" [\n" +" \"name\",\n" +" \"ShortText\"\n" +" ],\n" +" [\n" +" \"path\",\n" +" \"ShortText\"\n" +" ],\n" +" [\n" +" \"flags\",\n" +" \"ShortText\"\n" +" ],\n" +" [\n" +" \"domain\",\n" +" \"ShortText\"\n" +" ],\n" +" [\n" +" \"range\",\n" +" \"ShortText\"\n" +" ],\n" +" [\n" +" \"default_tokenizer\",\n" +" \"ShortText\"\n" +" ],\n" +" [\n" +" \"normalizer\",\n" +" \"ShortText\"\n" +" ]\n" +" ],\n" +" [\n" +" 256,\n" +" \"Store\",\n" +" \"/home/vagrant/droonga/000/db.0000100\",\n" +" \"TABLE_PAT_KEY|PERSISTENT\",\n" +" \"ShortText\",\n" +" null,\n" +" null,\n" +" null\n" +" ]\n" +" ]\n" +"]\n" +"~~~" msgstr "" msgid "### Load data to a table" @@ -533,8 +688,19 @@ msgid "Then, send it as a POST request of the `load` command, like:" msgstr "データが準備できたら、`load` コマンドのPOSTリクエストとして送信します:" msgid "" -" # curl --data \"@stores.json\" \"${endpoint}/d/load?table=Store\"\n" -" [[0,1401358564.909,0.158],[40]]" +"~~~\n" +"# curl --data \"@stores.json\" \"$endpoint/d/load?table=Store\" | jq \".\"\n" +"[\n" +" [\n" +" 0,\n" +" 1401358564.909,\n" +" 0.158\n" +" ],\n" +" [\n" +" 40\n" +" ]\n" +"]\n" +"~~~" msgstr "" msgid "Now all data in the JSON file are successfully loaded." @@ -550,30 +716,126 @@ msgid "As the starter, let's select initial ten records with the `select` comman msgstr "試しに、`select` コマンドを使って最初の10レコードを取り出してみましょう:" msgid "" -" # curl \"${endpoint}/d/select?table=Store&output_columns=name&limit=10\"\n" -" [[0,1401362059.7437818,0.00004935264587402344],[[[40],[[\"name\",\"ShortText\"" -"]],[\"1st Avenue & 75th St. - New York NY (W)\"],[\"76th & Second - New York NY " -" (W)\"],[\"Herald Square- Macy's - New York NY\"],[\"Macy's 5th Floor - Herald Squ" -"are - New York NY (W)\"],[\"80th & York - New York NY (W)\"],[\"Columbus @ 67th " -"- New York NY (W)\"],[\"45th & Broadway - New York NY (W)\"],[\"Marriott Marquis" -" - Lobby - New York NY\"],[\"Second @ 81st - New York NY (W)\"],[\"52nd & Seventh" -" - New York NY (W)\"]]]]" +"~~~\n" +"# curl \"$endpoint/d/select?table=Store&output_columns=name&limit=10\" | jq \".\"\n" +"[\n" +" [\n" +" 0,\n" +" 1401362059.7437818,\n" +" 4.935264587402344e-05\n" +" ],\n" +" [\n" +" [\n" +" [\n" +" 40\n" +" ],\n" +" [\n" +" [\n" +" \"name\",\n" +" \"ShortText\"\n" +" ]\n" +" ],\n" +" [\n" +" \"1st Avenue & 75th St. - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"76th & Second - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"Herald Square- Macy's - New York NY\"\n" +" ],\n" +" [\n" +" \"Macy's 5th Floor - Herald Square - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"80th & York - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"Columbus @ 67th - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"45th & Broadway - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"Marriott Marquis - Lobby - New York NY\"\n" +" ],\n" +" [\n" +" \"Second @ 81st - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"52nd & Seventh - New York NY (W)\"\n" +" ]\n" +" ]\n" +" ]\n" +"]\n" +"~~~" msgstr "" msgid "Of course you can specify conditions via the `query` option:" msgstr "もちろん、`query` オプションを使って検索条件を指定する事もできます:" msgid "" -" # curl \"${endpoint}/d/select?table=Store&query=Columbus&match_columns=name" -"&output_columns=name&limit=10\"\n" -" [[0,1398670157.661574,0.0012705326080322266],[[[2],[[\"_key\",\"ShortText\"]]," -"[\"Columbus @ 67th - New York NY (W)\"],[\"2 Columbus Ave. - New York NY (W)\"]]" -"]]\n" -" # curl \"${endpoint}/d/select?table=Store&filter=name@'Ave'&output_columns=" -"name&limit=10\"\n" -" [[0,1398670586.193325,0.0003848075866699219],[[[3],[[\"_key\",\"ShortText\"]]," -"[\"2nd Ave. & 9th Street - New York NY\"],[\"84th & Third Ave - New York NY (W)\"" -"],[\"2 Columbus Ave. - New York NY (W)\"]]]]" +"~~~\n" +"# curl \"$endpoint/d/select?table=Store&query=Columbus&match_columns=name&outpu" +"t_columns=name&limit=10\" | jq \".\"\n" +"[\n" +" [\n" +" 0,\n" +" 1398670157.661574,\n" +" 0.0012705326080322266\n" +" ],\n" +" [\n" +" [\n" +" [\n" +" 2\n" +" ],\n" +" [\n" +" [\n" +" \"_key\",\n" +" \"ShortText\"\n" +" ]\n" +" ],\n" +" [\n" +" \"Columbus @ 67th - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"2 Columbus Ave. - New York NY (W)\"\n" +" ]\n" +" ]\n" +" ]\n" +"]\n" +"# curl \"$endpoint/d/select?table=Store&filter=name@'Ave'&output_columns=name&l" +"imit=10\" | jq \".\"\n" +"[\n" +" [\n" +" 0,\n" +" 1398670586.193325,\n" +" 0.0003848075866699219\n" +" ],\n" +" [\n" +" [\n" +" [\n" +" 3\n" +" ],\n" +" [\n" +" [\n" +" \"_key\",\n" +" \"ShortText\"\n" +" ]\n" +" ],\n" +" [\n" +" \"2nd Ave. & 9th Street - New York NY\"\n" +" ],\n" +" [\n" +" \"84th & Third Ave - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"2 Columbus Ave. - New York NY (W)\"\n" +" ]\n" +" ]\n" +" ]\n" +"]\n" +"~~~" msgstr "" msgid "## Conclusion" Modified: ja/tutorial/1.0.6/dump-restore/index.md (+9 -9) =================================================================== --- ja/tutorial/1.0.6/dump-restore/index.md 2014-08-19 11:47:41 +0900 (ee852c1) +++ ja/tutorial/1.0.6/dump-restore/index.md 2014-08-19 11:52:14 +0900 (c8c2627) @@ -148,19 +148,19 @@ Droongaクラスタにそれらのメッセージを送信するには、`droong もし順番にこのチュートリアルを読み進めているのであれば、クラスタとダンプファイルが既に手元にあるはずです。以下の操作でクラスタを空にしましょう: # endpoint="http://192.168.0.10:10041" - # curl "${endpoint}/d/table_remove?name=Location" + # curl "$endpoint/d/table_remove?name=Location" [[0,1406610703.2229023,0.0010793209075927734],true] - # curl "${endpoint}/d/table_remove?name=Store" + # curl "$endpoint/d/table_remove?name=Store" [[0,1406610708.2757723,0.006396293640136719],true] - # curl "${endpoint}/d/table_remove?name=Term" + # curl "$endpoint/d/table_remove?name=Term" [[0,1406610712.379644,0.00006723403930664062],true] これでクラスタは空になりました。確かめてみましょう: # endpoint="http://192.168.0.10:10041" - # curl "${endpoint}/d/table_list" + # curl "$endpoint/d/table_list" [[0,1406610804.1535122,0.0002875328063964844],[[["id","UInt32"],["name","ShortText"],["path","ShortText"],["flags","ShortText"],["domain","ShortText"],["range","ShortText"],["default_tokenizer","ShortText"],["normalizer","ShortText"]]]] - # curl "${endpoint}/d/select?table=Store&output_columns=name&limit=10" + # curl "$endpoint/d/select?table=Store&output_columns=name&limit=10" [[0,1401363465.610241,0],[[[null],[]]]] ### ダンプ結果から空のDroongaクラスタへデータを復元する @@ -183,7 +183,7 @@ Droongaクラスタにそれらのメッセージを送信するには、`droong これで、データが完全に復元されました。確かめてみましょう: - # ${endpoint}/select?table=Store&output_columns=name&limit=10" + # $endpoint/select?table=Store&output_columns=name&limit=10" [[0,1401363556.0294158,0.0000762939453125],[[[40],[["name","ShortText"]],["1st Avenue & 75th St. - New York NY (W)"],["76th & Second - New York NY (W)"],["Herald Square- Macy's - New York NY"],["Macy's 5th Floor - Herald Square - New York NY (W)"],["80th & York - New York NY (W)"],["Columbus @ 67th - New York NY (W)"],["45th & Broadway - New York NY (W)"],["Marriott Marquis - Lobby - New York NY"],["Second @ 81st - New York NY (W)"],["52nd & Seventh - New York NY (W)"]]]] ## 既存のクラスタを別の空のクラスタに直接複製する @@ -209,9 +209,9 @@ Droongaクラスタにそれらのメッセージを送信するには、`droong --update \ --replica-hosts=$host # endpoint="http://$host:10041" - # curl "${endpoint}/d/table_remove?name=Location" - # curl "${endpoint}/d/table_remove?name=Store" - # curl "${endpoint}/d/table_remove?name=Term" + # curl "$endpoint/d/table_remove?name=Location" + # curl "$endpoint/d/table_remove?name=Store" + # curl "$endpoint/d/table_remove?name=Term" これで、ノード `192.168.0.10` を含む複製元クラスタと、ノード `192.168.0.11` を含む複製先の空のクラスタの、2つのクラスタができました。確かめてみましょう: Modified: ja/tutorial/1.0.6/groonga/index.md (+310 -29) =================================================================== --- ja/tutorial/1.0.6/groonga/index.md 2014-08-19 11:47:41 +0900 (aa638dd) +++ ja/tutorial/1.0.6/groonga/index.md 2014-08-19 11:52:14 +0900 (5eea2af) @@ -157,7 +157,7 @@ GroongaをHTTPサーバとして使う場合は、以下のように `-d` オプ コマンドはHTTP経由で実行できます: ~~~ -# curl "http://192.168.0.10:10041/droonga/system/status" +# curl "http://192.168.0.10:10041/droonga/system/status" | jq "." { "nodes": { "192.168.0.10:10031/droonga": { @@ -174,7 +174,7 @@ GroongaをHTTPサーバとして使う場合は、以下のように `-d` オプ Droongaはクラスタで動作するので、他のエンドポイントも同じ結果を返します。 ~~~ -# curl "http://192.168.0.11:10041/droonga/system/status" +# curl "http://192.168.0.11:10041/droonga/system/status" | jq "." { "nodes": { "192.168.0.10:10031/droonga": { @@ -199,9 +199,19 @@ Droongaはクラスタで動作するので、他のエンドポイントも同 リクエストの送信方法はGroongaサーバの場合と全く同じです。 新しいテーブル `Store` を作るには、`table_create` コマンドにあたるGETリクエストを送信して下さい: - # endpoint="http://192.168.0.10:10041" - # curl "${endpoint}/d/table_create?name=Store&flags=TABLE_PAT_KEY&key_type=ShortText" - [[0,1401358896.360356,0.0035653114318847656],true] +~~~ +# endpoint="http://192.168.0.10:10041" +# curl "$endpoint/d/table_create?name=Store&flags=TABLE_PAT_KEY&key_type=ShortText" | jq "." +[ + [ + 0, + 1401358896.360356, + 0.0035653114318847656 + ], + true +] +~~~ + リクエストの送信先として、Droongaノード中でdroonga-http-serverが動作しているDroongaノードのどれか1つを指定する必要がある事に注意して下さい。 言い換えると、接続先(エンドポイント)としてはクラスタ中のどのノードでも好きな物を使う事ができます。 @@ -209,34 +219,188 @@ Droongaはクラスタで動作するので、他のエンドポイントも同 次は、`column_create` コマンドを使って `Store` テーブルに `name` と `location` という新しいカラムを作ります: - # curl "${endpoint}/d/column_create?table=Store&name=name&flags=COLUMN_SCALAR&type=ShortText" - [[0,1401358348.6541538,0.0004096031188964844],true] - # curl "${endpoint}/d/column_create?table=Store&name=location&flags=COLUMN_SCALAR&type=WGS84GeoPoint" - [[0,1401358359.084659,0.002511262893676758],true],true] +~~~ +# curl "$endpoint/d/column_create?table=Store&name=name&flags=COLUMN_SCALAR&type=ShortText" | jq "." +[ + [ + 0, + 1401358348.6541538, + 0.0004096031188964844 + ], + true +] +# curl "$endpoint/d/column_create?table=Store&name=location&flags=COLUMN_SCALAR&type=WGS84GeoPoint" | jq "." +[ + [ + 0, + 1401358359.084659, + 0.002511262893676758 + ], + true +] +~~~ インデックスも作成しましょう。 - # curl "${endpoint}/d/table_create?name=Term&flags=TABLE_PAT_KEY&key_type=ShortText&default_tokenizer=TokenBigram&normalizer=NormalizerAuto" - [[0,1401358475.7229664,0.002419710159301758],true] - # curl "${endpoint}/d/column_create?table=Term&name=store_name&flags=COLUMN_INDEX|WITH_POSITION&type=Store&source=name" - [[0,1401358494.1656318,0.006799221038818359],true] - # curl "${endpoint}/d/table_create?name=Location&flags=TABLE_PAT_KEY&key_type=WGS84GeoPoint" - [[0,1401358505.708896,0.0016951560974121094],true] - # curl "${endpoint}/d/column_create?table=Location&name=store&flags=COLUMN_INDEX&type=Store&source=location" - [[0,1401358519.6187897,0.024788379669189453],true] +~~~ +# curl "$endpoint/d/table_create?name=Term&flags=TABLE_PAT_KEY&key_type=ShortText&default_tokenizer=TokenBigram&normalizer=NormalizerAuto" | jq "." +[ + [ + 0, + 1401358475.7229664, + 0.002419710159301758 + ], + true +] +# curl "$endpoint/d/column_create?table=Term&name=store_name&flags=COLUMN_INDEX|WITH_POSITION&type=Store&source=name" | jq "." +[ + [ + 0, + 1401358494.1656318, + 0.006799221038818359 + ], + true +] +# curl "$endpoint/d/table_create?name=Location&flags=TABLE_PAT_KEY&key_type=WGS84GeoPoint" | jq "." +[ + [ + 0, + 1401358505.708896, + 0.0016951560974121094 + ], + true +] +# curl "$endpoint/d/column_create?table=Location&name=store&flags=COLUMN_INDEX&type=Store&source=location" | jq "." +[ + [ + 0, + 1401358519.6187897, + 0.024788379669189453 + ], + true +] +~~~ *注意*: テーブルが完全にできあがるまでは、`table_list` や `column_list` といったコマンドを実行しないでください。テーブルができあがる前にこれらのコマンドを実行してしまうと、インデックスが破損した状態になってしまいます。これはバージョン{{ site.droonga_version }}での既知の不具合で、将来のバージョンで修正される予定です。 さて、テーブルを正しく作成できました。 `table_list` コマンドを使って、作成されたテーブルの情報を見てみましょう: - # curl "${endpoint}/d/table_list" - [[0,1401358908.9126804,0.001600027084350586],[[["id","UInt32"],["name","ShortText"],["path","ShortText"],["flags","ShortText"],["domain","ShortText"],["range","ShortText"],["default_tokenizer","ShortText"],["normalizer","ShortText"]],[256,"Store","/home/vagrant/droonga/000/db.0000100","TABLE_PAT_KEY|PERSISTENT","ShortText",null,null,null]]] +~~~ +# curl "$endpoint/d/table_list" | jq "." +[ + [ + 0, + 1401358908.9126804, + 0.001600027084350586 + ], + [ + [ + [ + "id", + "UInt32" + ], + [ + "name", + "ShortText" + ], + [ + "path", + "ShortText" + ], + [ + "flags", + "ShortText" + ], + [ + "domain", + "ShortText" + ], + [ + "range", + "ShortText" + ], + [ + "default_tokenizer", + "ShortText" + ], + [ + "normalizer", + "ShortText" + ] + ], + [ + 256, + "Store", + "/home/vagrant/droonga/000/db.0000100", + "TABLE_PAT_KEY|PERSISTENT", + "ShortText", + null, + null, + null + ] + ] +] +~~~ Droongaはクラスタで動作するので、他のエンドポイントも同じ結果を返します。 - # curl "http://192.168.0.11:10041/d/table_list" - [[0,1401358908.9126804,0.001600027084350586],[[["id","UInt32"],["name","ShortText"],["path","ShortText"],["flags","ShortText"],["domain","ShortText"],["range","ShortText"],["default_tokenizer","ShortText"],["normalizer","ShortText"]],[256,"Store","/home/vagrant/droonga/000/db.0000100","TABLE_PAT_KEY|PERSISTENT","ShortText",null,null,null]]] +~~~ +# curl "http://192.168.0.11:10041/d/table_list" | jq "." +[ + [ + 0, + 1401358908.9126804, + 0.001600027084350586 + ], + [ + [ + [ + "id", + "UInt32" + ], + [ + "name", + "ShortText" + ], + [ + "path", + "ShortText" + ], + [ + "flags", + "ShortText" + ], + [ + "domain", + "ShortText" + ], + [ + "range", + "ShortText" + ], + [ + "default_tokenizer", + "ShortText" + ], + [ + "normalizer", + "ShortText" + ] + ], + [ + 256, + "Store", + "/home/vagrant/droonga/000/db.0000100", + "TABLE_PAT_KEY|PERSISTENT", + "ShortText", + null, + null, + null + ] + ] +] +~~~ ### テーブルへのデータの読み込み @@ -293,8 +457,19 @@ stores.json: データが準備できたら、`load` コマンドのPOSTリクエストとして送信します: - # curl --data "@stores.json" "${endpoint}/d/load?table=Store" - [[0,1401358564.909,0.158],[40]] +~~~ +# curl --data "@stores.json" "$endpoint/d/load?table=Store" | jq "." +[ + [ + 0, + 1401358564.909, + 0.158 + ], + [ + 40 + ] +] +~~~ これで、JSONファイル中のすべてのデータが正しく読み込まれます。 @@ -304,15 +479,121 @@ stores.json: 試しに、`select` コマンドを使って最初の10レコードを取り出してみましょう: - # curl "${endpoint}/d/select?table=Store&output_columns=name&limit=10" - [[0,1401362059.7437818,0.00004935264587402344],[[[40],[["name","ShortText"]],["1st Avenue & 75th St. - New York NY (W)"],["76th & Second - New York NY (W)"],["Herald Square- Macy's - New York NY"],["Macy's 5th Floor - Herald Square - New York NY (W)"],["80th & York - New York NY (W)"],["Columbus @ 67th - New York NY (W)"],["45th & Broadway - New York NY (W)"],["Marriott Marquis - Lobby - New York NY"],["Second @ 81st - New York NY (W)"],["52nd & Seventh - New York NY (W)"]]]] +~~~ +# curl "$endpoint/d/select?table=Store&output_columns=name&limit=10" | jq "." +[ + [ + 0, + 1401362059.7437818, + 4.935264587402344e-05 + ], + [ + [ + [ + 40 + ], + [ + [ + "name", + "ShortText" + ] + ], + [ + "1st Avenue & 75th St. - New York NY (W)" + ], + [ + "76th & Second - New York NY (W)" + ], + [ + "Herald Square- Macy's - New York NY" + ], + [ + "Macy's 5th Floor - Herald Square - New York NY (W)" + ], + [ + "80th & York - New York NY (W)" + ], + [ + "Columbus @ 67th - New York NY (W)" + ], + [ + "45th & Broadway - New York NY (W)" + ], + [ + "Marriott Marquis - Lobby - New York NY" + ], + [ + "Second @ 81st - New York NY (W)" + ], + [ + "52nd & Seventh - New York NY (W)" + ] + ] + ] +] +~~~ もちろん、`query` オプションを使って検索条件を指定する事もできます: - # curl "${endpoint}/d/select?table=Store&query=Columbus&match_columns=name&output_columns=name&limit=10" - [[0,1398670157.661574,0.0012705326080322266],[[[2],[["_key","ShortText"]],["Columbus @ 67th - New York NY (W)"],["2 Columbus Ave. - New York NY (W)"]]]] - # curl "${endpoint}/d/select?table=Store&filter=name@'Ave'&output_columns=name&limit=10" - [[0,1398670586.193325,0.0003848075866699219],[[[3],[["_key","ShortText"]],["2nd Ave. & 9th Street - New York NY"],["84th & Third Ave - New York NY (W)"],["2 Columbus Ave. - New York NY (W)"]]]] +~~~ +# curl "$endpoint/d/select?table=Store&query=Columbus&match_columns=name&output_columns=name&limit=10" | jq "." +[ + [ + 0, + 1398670157.661574, + 0.0012705326080322266 + ], + [ + [ + [ + 2 + ], + [ + [ + "_key", + "ShortText" + ] + ], + [ + "Columbus @ 67th - New York NY (W)" + ], + [ + "2 Columbus Ave. - New York NY (W)" + ] + ] + ] +] +# curl "$endpoint/d/select?table=Store&filter=name@'Ave'&output_columns=name&limit=10" | jq "." +[ + [ + 0, + 1398670586.193325, + 0.0003848075866699219 + ], + [ + [ + [ + 3 + ], + [ + [ + "_key", + "ShortText" + ] + ], + [ + "2nd Ave. & 9th Street - New York NY" + ], + [ + "84th & Third Ave - New York NY (W)" + ], + [ + "2 Columbus Ave. - New York NY (W)" + ] + ] + ] +] +~~~ ## まとめ -------------- next part -------------- HTML����������������������������... Download