[Groonga-commit] droonga/droonga.org at 206db5c [gh-pages] Update search trial subsection

Back to archive index

Yoji Shidara null+****@clear*****
Wed Nov 13 14:33:35 JST 2013


Yoji Shidara	2013-11-13 14:33:35 +0900 (Wed, 13 Nov 2013)

  New Revision: 206db5c0a9629713c842d6b6c427b220701e8eac
  https://github.com/droonga/droonga.org/commit/206db5c0a9629713c842d6b6c427b220701e8eac

  Merged 0ba1e61: Merge branch 'distributed-tutorial' into gh-pages

  Message:
    Update search trial subsection

  Modified files:
    tutorial/index.md

  Modified: tutorial/index.md (+44 -16)
===================================================================
--- tutorial/index.md    2013-11-13 14:10:50 +0900 (099dbc3)
+++ tutorial/index.md    2013-11-13 14:33:35 +0900 (549fae7)
@@ -321,52 +321,81 @@ application.js:
 
 準備が整いました。 Protocol Adapter に向けて HTTP 経由でリクエストを発行し、データベースに問い合わせを行ってみましょう。まずは `Shops` テーブルの中身を取得してみます。以下のようなリクエストを用います。(`attributes=_key` を指定しているのは「検索結果に `_key` 値を含めて返してほしい」という意味です。これがないと、`records` に何も値がないレコードが返ってきてしまいます。`attributes` パラメータには `,` 区切りで複数の属性を指定することができます。`attributes=_key,location` と指定することで、緯度経度もレスポンスとして受け取ることができます)
 
-    $ curl "http://localhost:3000/droonga/tables/Shops?attributes=_key"
+    $ curl "http://localhost:3000/droonga/tables/Shop?attrbutes=_key"
     {
       "result": {
         "count": 36,
         "records": [
           [
-            "根津のたいやき"
+            "たい焼 カタオカ"
           ],
           [
-            "たい焼 カタオカ"
+            "根津のたいやき"
           ],
           [
             "そばたいやき空"
           ],
           [
+            "さざれ"
+          ],
+          [
+            "おめで鯛焼き本舗錦糸町東急店"
+          ],
+          [
+            "尾長屋 錦糸町店"
+          ],
+          [
+            "たいやき本舗 藤家 阿佐ヶ谷店"
+          ],
+          [
+            "みよし"
+          ],
+          [
+            "たい焼き / たつみや"
+          ],
+          [
+            "吾妻屋"
+          ],
+          [
+            "たいやき神田達磨 八重洲店"
+          ],
+          [
             "車"
           ],
           [
             "広瀬屋"
           ],
           [
-            "さざれ"
+            "たいやき工房白家 阿佐ヶ谷店"
           ],
           [
-            "おめで鯛焼き本舗錦糸町東急店"
+            "寿々屋 菓子"
           ],
           [
-            "尾長屋 錦糸町店"
+            "たい焼き鉄次 大丸東京店"
           ],
           [
-            "たいやき工房白家 阿佐ヶ谷店"
+            "ほんま門"
           ],
           [
-            "たいやき本舗 藤家 阿佐ヶ谷店"
+            "浪花家"
+          ],
+          [
+            "代官山たい焼き黒鯛"
+          ],
+          [
+            "ダ・カーポ"
           ]
-        ],
-        "startTime": "2013-08-28T06:00:13+00:00",
-        "elapsedTime": 0.0002779960632324219
+        ]
       }
     }
 
-`count` の値からデータが全部で 36 件あることがわかります。そのうちの 10 件が取得できました。
+`count` の値からデータが全部で 36 件あることがわかります。`records` に配列として検索結果が入っています。
 
 もう少し複雑なクエリを試してみましょう。例えば、店名に「阿佐ヶ谷」を含むたいやき屋を検索します。`query` パラメータにクエリ `阿佐ヶ谷` を URL エンコードした `%E9%98%BF%E4%BD%90%E3%83%B6%E8%B0%B7` を、`match_to` パラメータに検索対象として `_key` を指定し、以下のようなリクエストを発行します。
 
-    $ curl "http://localhost:3000/droonga/tables/Shops?query=%E9%98%BF%E4%BD%90%E3%83%B6%E8%B0%B7&match_to=_key&attributes=_key"
+
+    $ curl "http://localhost:3000/droonga/tables/Shop?quer=%E9%98%BF%E4%BD%90%E3%83%B6%E8%B0%B7&match_to=_key&attributes=_key"
     {
       "result": {
         "count": 2,
@@ -377,10 +406,9 @@ application.js:
           [
             "たいやき本舗 藤家 阿佐ヶ谷店"
           ]
-        ],
-        "startTime": "2013-08-28T06:18:08+00:00",
-        "elapsedTime": 0.0005409717559814453
+        ]
       }
+    }
 
 以上 2 件が検索結果として該当することがわかりました。
 
-------------- next part --------------
HTML����������������������������...
Download 



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