[Groonga-commit] groonga/fluent-plugin-droonga [master] Use instance variable directly

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Apr 9 18:37:32 JST 2013


Kouhei Sutou	2013-04-09 18:37:32 +0900 (Tue, 09 Apr 2013)

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

  Message:
    Use instance variable directly

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

  Modified: lib/droonga/plugin/handler_search.rb (+17 -18)
===================================================================
--- lib/droonga/plugin/handler_search.rb    2013-04-09 18:35:51 +0900 (444a529)
+++ lib/droonga/plugin/handler_search.rb    2013-04-09 18:37:32 +0900 (058f0c8)
@@ -89,7 +89,7 @@ module Droonga
       end
 
       def search(results)
-        search_query(@query, results)
+        search_query(results)
       end
 
       def need_output?
@@ -100,12 +100,11 @@ module Droonga
         return nil unless need_output?
 
         params = @query["output"]
-        result = @result
         output = {}
         offset = params["offset"] || 0
         limit = params["limit"] || 10
         if params["count"]
-          count = result.size
+          count =****@resul*****
           output["count"] = count
         end
         if params["attributes"].is_a? Array
@@ -117,8 +116,8 @@ module Droonga
                 source: attribute["source"] }
             end
           end
-          output["records"] = result.open_cursor(:offset => offset,
-                                                 :limit => limit) do |cursor|
+          output["records"] =****@resul*****_cursor(:offset => offset,
+                                                  :limit => limit) do |cursor|
             cursor.collect do |record|
               values = {}
               attributes.collect do |attribute|
@@ -211,27 +210,27 @@ module Droonga
         end
       end
 
-      def search_query(query, results)
+      def search_query(results)
         @start_time = Time.now
-        result = source = results[query["source"]]
-        if query["condition"]
+        result = source = results[@query["source"]]
+        if @query["condition"]
           expression = Groonga::Expression.new(context: @context)
           expression.define_variable(:domain => source)
-          parseCondition(source, expression, query["condition"])
+          parseCondition(source, expression, @query["condition"])
           result = source.select(expression)
         end
-        if query["groupBy"]
-          result = result.group(query["groupBy"])
+        if @query["groupBy"]
+          result = result.group(@query["groupBy"])
         end
-        if query["sortBy"]
-          if query["sortBy"].is_a? Array
-            keys = parseOrderKeys(query["sortBy"])
+        if @query["sortBy"]
+          if @query["sortBy"].is_a? Array
+            keys = parseOrderKeys(@query["sortBy"])
             offset = 0
             limit = -1
-          elsif query["sortBy"].is_a? Hash
-            keys = parseOrderKeys(query["sortBy"]["keys"])
-            offset = query["sortBy"]["offset"]
-            limit = query["sortBy"]["limit"]
+          elsif @query["sortBy"].is_a? Hash
+            keys = parseOrderKeys(@query["sortBy"]["keys"])
+            offset = @query["sortBy"]["offset"]
+            limit = @query["sortBy"]["limit"]
           else
             raise '"sortBy" parameter must be a Hash or an Array'
           end
-------------- next part --------------
HTML����������������������������...
Download 



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