[Groonga-commit] droonga/fluent-plugin-droonga at 5b8852a [master] Add test for search distributor about hash style sortBy

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Nov 28 11:15:21 JST 2013


YUKI Hiroshi	2013-11-28 11:15:21 +0900 (Thu, 28 Nov 2013)

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

  Message:
    Add test for search distributor about hash style sortBy

  Modified files:
    test/unit/plugin/distributor/test_search.rb

  Modified: test/unit/plugin/distributor/test_search.rb (+45 -0)
===================================================================
--- test/unit/plugin/distributor/test_search.rb    2013-11-28 11:13:34 +0900 (4624a02)
+++ test/unit/plugin/distributor/test_search.rb    2013-11-28 11:15:21 +0900 (3a40200)
@@ -404,6 +404,51 @@ class SearchDistributorTest < Test::Unit::TestCase
       assert_equal(message, @posted.last.last)
     end
 
+    def test_have_sortBy
+      envelope = {
+        "type" => "search",
+        "dataset" => "Droonga",
+        "body" => {
+          "queries" => {
+            "have_records" => {
+              "source" => "User",
+              "sortBy" => {
+                "keys" => ["name"],
+              },
+              "output" => {
+                "format" => "complex",
+                "elements" => ["count", "records"],
+                "attributes" => ["_key", "name", "age"],
+                "offset" => 0,
+                "limit" => 1,
+              },
+            },
+          },
+        },
+      }
+
+      @plugin.process("search", envelope)
+
+      message = []
+      message << reducer(envelope, {
+        "count" => {
+          "type" => "sum",
+        },
+        "records" => {
+          "type" => "sort",
+          "order" => ["<"],
+          "offset" => 0,
+          "limit" => 1,
+        },
+      })
+      message << gatherer(envelope)
+      message << searcher(envelope, :sort_offset => 0,
+                                    :sort_limit => 1,
+                                    :output_offset => 0,
+                                    :output_limit => 1)
+      assert_equal(message, @posted.last.last)
+    end
+
     # XXX we should write cases for...
     #  - sortBy(simple)
     #  - sortBy(rich)
-------------- next part --------------
HTML����������������������������...
Download 



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