[Groonga-commit] droonga/fluent-plugin-droonga at fdc6a8b [master] search: support elapsedTime output

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Mar 24 22:52:23 JST 2014


Kouhei Sutou	2014-03-24 22:52:23 +0900 (Mon, 24 Mar 2014)

  New Revision: fdc6a8be8123f838431f7def49df9a9d51e163a0
  https://github.com/droonga/fluent-plugin-droonga/commit/fdc6a8be8123f838431f7def49df9a9d51e163a0

  Message:
    search: support elapsedTime output

  Added files:
    test/command/suite/search/response/elapsed_time.catalog.json
    test/command/suite/search/response/elapsed_time.expected
    test/command/suite/search/response/elapsed_time.test
  Modified files:
    lib/droonga/plugins/search/distributed_search_planner.rb

  Modified: lib/droonga/plugins/search/distributed_search_planner.rb (+9 -0)
===================================================================
--- lib/droonga/plugins/search/distributed_search_planner.rb    2014-03-24 16:25:28 +0900 (7c08a2d)
+++ lib/droonga/plugins/search/distributed_search_planner.rb    2014-03-24 22:52:23 +0900 (dcc564f)
@@ -122,6 +122,7 @@ module Droonga
 
             calculate_offset_and_limit!
             build_count_mapper_and_reducer!
+            build_elapsed_time_mapper_and_reducer!
             build_records_mapper_and_reducer!
           end
 
@@ -256,6 +257,14 @@ module Droonga
             end
           end
 
+          def build_elapsed_time_mapper_and_reducer!
+            return unless @output["elements"].include?("elapsedTime")
+
+            @reducers["elapsedTime"] = {
+              "type" => "sum",
+            }
+          end
+
           def build_records_mapper_and_reducer!
             # Skip reducing phase for a result with no record output.
             return if !@output["elements"].include?("records") || @records_limit.zero?

  Added: test/command/suite/search/response/elapsed_time.catalog.json (+13 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/search/response/elapsed_time.catalog.json    2014-03-24 22:52:23 +0900 (295bb90)
@@ -0,0 +1,13 @@
+{
+  "datasets": {
+    "Droonga": {
+      "fact": "Memos",
+      "schema": {
+        "Memos": {
+          "type": "Hash",
+          "keyType": "ShortText"
+        }
+      }
+    }
+  }
+}

  Added: test/command/suite/search/response/elapsed_time.expected (+15 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/search/response/elapsed_time.expected    2014-03-24 22:52:23 +0900 (5a39ccb)
@@ -0,0 +1,15 @@
+[
+  "droonga.message",
+  0,
+  {
+    "inReplyTo": "request-id",
+    "statusCode": 200,
+    "type": "search.result",
+    "body": {
+      "memos": {
+        "count": 1,
+        "elapsedTime": 0.0
+      }
+    }
+  }
+]

  Added: test/command/suite/search/response/elapsed_time.test (+26 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/search/response/elapsed_time.test    2014-03-24 22:52:23 +0900 (234f845)
@@ -0,0 +1,26 @@
+# -*- js -*-
+#@require-catalog-version 2
+#@disable-logging
+{
+  "type": "add",
+  "dataset": "Droonga",
+  "body": {
+    "table": "Memos",
+    "key": "Droonga is fun"
+  }
+}
+#@enable-logging
+{
+  "type": "search",
+  "dataset": "Droonga",
+  "body": {
+    "queries": {
+      "memos": {
+        "source": "Memos",
+        "output": {
+          "elements": ["count", "elapsedTime"]
+        }
+      }
+    }
+  }
+}
-------------- next part --------------
HTML����������������������������...
Download 



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