[Groonga-commit] groonga/fluent-plugin-droonga [master] Reduce duplicated query["output"] access

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Apr 9 18:28:51 JST 2013


Kouhei Sutou	2013-04-09 18:28:51 +0900 (Tue, 09 Apr 2013)

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

  Message:
    Reduce duplicated query["output"] access

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

  Modified: lib/droonga/plugin/handler_search.rb (+7 -7)
===================================================================
--- lib/droonga/plugin/handler_search.rb    2013-04-09 18:24:57 +0900 (7271ad0)
+++ lib/droonga/plugin/handler_search.rb    2013-04-09 18:28:51 +0900 (d13db5f)
@@ -204,17 +204,17 @@ module Droonga
       def output
         return nil unless need_output?
 
-        query = @query
+        params = @query["output"]
         result = @result
         output = {}
-        offset = query["output"]["offset"] || 0
-        limit = query["output"]["limit"] || 10
-        if query["output"]["count"]
+        offset = params["offset"] || 0
+        limit = params["limit"] || 10
+        if params["count"]
           count = result.size
           output["count"] = count
         end
-        if query["output"]["attributes"].is_a? Array
-          attributes = query["output"]["attributes"].map do |attribute|
+        if params["attributes"].is_a? Array
+          attributes = params["attributes"].map do |attribute|
             if attribute.is_a?(String)
               { label: attribute, source: attribute}
             else
@@ -233,7 +233,7 @@ module Droonga
             end
           end
         end
-        if query["output"]["elapsedTime"]
+        if params["elapsedTime"]
           output["startTime"] = start_time.iso8601
           output["elapsedTime"] = Time.now.to_f - start_time.to_f
         end
-------------- next part --------------
HTML����������������������������...
Download 



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