[Groonga-commit] droonga/fluent-plugin-droonga at 2ee0fcd [master] Add test for distributor about simple sortBy

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Nov 28 11:13:34 JST 2013


YUKI Hiroshi	2013-11-28 11:13:34 +0900 (Thu, 28 Nov 2013)

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

  Message:
    Add test for distributor about simple sortBy

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

  Modified: test/unit/plugin/distributor/test_search.rb (+43 -2)
===================================================================
--- test/unit/plugin/distributor/test_search.rb    2013-11-28 11:13:08 +0900 (7c62827)
+++ test/unit/plugin/distributor/test_search.rb    2013-11-28 11:13:34 +0900 (4624a02)
@@ -354,12 +354,53 @@ class SearchDistributorTest < Test::Unit::TestCase
           "type" => "sort",
           "order" => ["<"],
           "offset" => 1,
-          "limit" => 2,
+          "limit" => 1,
+        },
+      })
+      message << gatherer(envelope)
+      message << searcher(envelope, :output_offset => 0,
+                                    :output_limit => 2)
+      assert_equal(message, @posted.last.last)
+    end
+
+    def test_have_simple_sortBy
+      envelope = {
+        "type" => "search",
+        "dataset" => "Droonga",
+        "body" => {
+          "queries" => {
+            "have_records" => {
+              "source" => "User",
+              "sortBy" => ["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, :output_offset => 0,
-                                    :output_limit => 3)
+                                    :output_limit => 1)
       assert_equal(message, @posted.last.last)
     end
 
-------------- next part --------------
HTML����������������������������...
Download 



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