[Groonga-commit] droonga/droonga.org at 7caedbb [gh-pages] tutorial handler: make workable

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Feb 28 16:35:56 JST 2014


Kouhei Sutou	2014-02-28 16:35:56 +0900 (Fri, 28 Feb 2014)

  New Revision: 7caedbb29c494910c9db89a7dc8ac964ce0be1a3
  https://github.com/droonga/droonga.org/commit/7caedbb29c494910c9db89a7dc8ac964ce0be1a3

  Message:
    tutorial handler: make workable

  Modified files:
    _po/ja/tutorial/plugin-development/handler/index.po
    ja/tutorial/plugin-development/handler/index.md
    tutorial/plugin-development/handler/index.md

  Modified: _po/ja/tutorial/plugin-development/handler/index.po (+8 -4)
===================================================================
--- _po/ja/tutorial/plugin-development/handler/index.po    2014-02-28 16:27:16 +0900 (d68039a)
+++ _po/ja/tutorial/plugin-development/handler/index.po    2014-02-28 16:35:56 +0900 (23f664d)
@@ -476,7 +476,7 @@ msgid ""
 "  \"dataset\" : \"Starbucks\",\n"
 "  \"type\"    : \"deleteStores\",\n"
 "  \"body\"    : {\n"
-"    \"keyword\": \"Broardway\"\n"
+"    \"keyword\": \"Broadway\"\n"
 "  }\n"
 "}\n"
 "~~~"
@@ -588,10 +588,10 @@ msgid ""
 "      class Handler < Droonga::Handler\n"
 "        def handle(message)\n"
 "          request = message.request\n"
-"          keyword = request[\"body\"][\"keyword\"]\n"
+"          keyword = request[\"keyword\"]\n"
 "          table = @context[\"Store\"]\n"
 "          table.delete do |record|\n"
-"            record.key @ keyword\n"
+"            record.key =~ keyword\n"
 "          end\n"
 "          true\n"
 "        end\n"
@@ -676,7 +676,11 @@ msgid ""
 "    \"inReplyTo\": \"1392621168.0119512\",\n"
 "    \"statusCode\": 200,\n"
 "    \"type\": \"countRecords.result\",\n"
-"    \"body\": [8, 8, 7]\n"
+"    \"body\": [\n"
+"      7,\n"
+"      13,\n"
+"      6\n"
+"    ]\n"
 "  }\n"
 "]\n"
 "~~~"

  Modified: ja/tutorial/plugin-development/handler/index.md (+8 -9)
===================================================================
--- ja/tutorial/plugin-development/handler/index.md    2014-02-28 16:27:16 +0900 (1809ece)
+++ ja/tutorial/plugin-development/handler/index.md    2014-02-28 16:35:56 +0900 (0184995)
@@ -344,7 +344,7 @@ The request must have the condition to select records to be deleted, like:
   "dataset" : "Starbucks",
   "type"    : "deleteStores",
   "body"    : {
-    "keyword": "Broardway"
+    "keyword": "Broadway"
   }
 }
 ~~~
@@ -450,10 +450,10 @@ module Droonga
       class Handler < Droonga::Handler
         def handle(message)
           request = message.request
-          keyword = request["body"]["keyword"]
+          keyword = request["keyword"]
           table = @context["Store"]
           table.delete do |record|
-            record.key @ keyword
+            record.key =~ keyword
           end
           true
         end
@@ -470,8 +470,6 @@ The handler finds and deletes existing records which have the given keyword in i
 And, the `Collectors::And` is bound to the step by the configuration `step.collector`.
 It is is also one of built-in collectors, and merges boolean values retuned from handler instances for each partition and replica, to one boolean value.
 
-
-
 ### Activate the plugin with `catalog.json`
 
 Update catalog.json to activate this plugin.
@@ -520,7 +518,11 @@ Elapsed time: 0.01494
     "inReplyTo": "1392621168.0119512",
     "statusCode": 200,
     "type": "countRecords.result",
-    "body": [8, 8, 7]
+    "body": [
+      7,
+      13,
+      6
+    ]
   }
 ]
 ~~~
@@ -528,9 +530,6 @@ Elapsed time: 0.01494
 Note, the number of records are smaller than the previous result.
 This means that 4 or some records are deleted from each partitions.
 
-
-
-
 ## まとめ
 
 We have learned how to create plugins work in handling phrase.

  Modified: tutorial/plugin-development/handler/index.md (+8 -9)
===================================================================
--- tutorial/plugin-development/handler/index.md    2014-02-28 16:27:16 +0900 (4ac45da)
+++ tutorial/plugin-development/handler/index.md    2014-02-28 16:35:56 +0900 (49adec3)
@@ -335,7 +335,7 @@ The request must have the condition to select records to be deleted, like:
   "dataset" : "Starbucks",
   "type"    : "deleteStores",
   "body"    : {
-    "keyword": "Broardway"
+    "keyword": "Broadway"
   }
 }
 ~~~
@@ -441,10 +441,10 @@ module Droonga
       class Handler < Droonga::Handler
         def handle(message)
           request = message.request
-          keyword = request["body"]["keyword"]
+          keyword = request["keyword"]
           table = @context["Store"]
           table.delete do |record|
-            record.key @ keyword
+            record.key =~ keyword
           end
           true
         end
@@ -461,8 +461,6 @@ The handler finds and deletes existing records which have the given keyword in i
 And, the `Collectors::And` is bound to the step by the configuration `step.collector`.
 It is is also one of built-in collectors, and merges boolean values retuned from handler instances for each partition and replica, to one boolean value.
 
-
-
 ### Activate the plugin with `catalog.json`
 
 Update catalog.json to activate this plugin.
@@ -511,7 +509,11 @@ Elapsed time: 0.01494
     "inReplyTo": "1392621168.0119512",
     "statusCode": 200,
     "type": "countRecords.result",
-    "body": [8, 8, 7]
+    "body": [
+      7,
+      13,
+      6
+    ]
   }
 ]
 ~~~
@@ -519,9 +521,6 @@ Elapsed time: 0.01494
 Note, the number of records are smaller than the previous result.
 This means that 4 or some records are deleted from each partitions.
 
-
-
-
 ## Conclusion
 
 We have learned how to add a new simple command working around the data.
-------------- next part --------------
HTML����������������������������...
Download 



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