[Groonga-commit] groonga/fluent-plugin-droonga [master] Support "groupBy" parameter

Back to archive index

Daijiro MORI null+****@clear*****
Tue Apr 2 17:46:10 JST 2013


Daijiro MORI	2013-04-02 17:46:10 +0900 (Tue, 02 Apr 2013)

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

  Message:
    Support "groupBy" parameter

  Modified files:
    lib/droonga/plugin/handler_search.rb

  Modified: lib/droonga/plugin/handler_search.rb (+6 -5)
===================================================================
--- lib/droonga/plugin/handler_search.rb    2013-04-02 15:35:40 +0900 (e1e8910)
+++ lib/droonga/plugin/handler_search.rb    2013-04-02 17:46:10 +0900 (070042b)
@@ -113,17 +113,18 @@ module Droonga
     def search_query(name, queries, results, outputs)
       start_time = Time.now
       query = queries[name]
-      source = results[query["source"]]
+      result = source = results[query["source"]]
       if query["condition"]
         expression = Groonga::Expression.new(context: @context)
         expression.define_variable(:domain => source)
         parseCondition(source, expression, query["condition"])
-        results[name] = source.select(expression)
-      else
-        results[name] = source
+        result = source.select(expression)
+      end
+      if query["groupBy"]
+        result = result.group(query["groupBy"])
       end
+      results[name] = result
       if query["output"]
-        result = results[name]
         offset = query["offset"] || 0
         limit = query["limit"] || 10
         outputs[name] = output = {}
-------------- next part --------------
HTML����������������������������...
Download 



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