[Groonga-commit] droonga/fluent-plugin-droonga at b343885 [master] Extract the logic to collect original column names from attributes

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Nov 28 18:39:41 JST 2013


YUKI Hiroshi	2013-11-28 18:39:41 +0900 (Thu, 28 Nov 2013)

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

  Message:
    Extract the logic to collect original column names from attributes

  Modified files:
    lib/droonga/plugin/distributor/search.rb

  Modified: lib/droonga/plugin/distributor/search.rb (+11 -5)
===================================================================
--- lib/droonga/plugin/distributor/search.rb    2013-11-28 18:39:12 +0900 (7576d37)
+++ lib/droonga/plugin/distributor/search.rb    2013-11-28 18:39:41 +0900 (134562a)
@@ -187,18 +187,17 @@ module Droonga
       end
     end
 
-    def collect_sort_attributes(attributes, sort_keys)
-      sort_keys ||= []
-      sort_keys = sort_keys["keys"] || [] if sort_keys.is_a?(Hash)
-
+    def collect_source_column_names(attributes)
+      attributes ||= []
       if attributes.is_a?(Hash)
         attributes_hash = attributes
         attributes = []
         attributes_hash.each do |key, attribute|
           attributes << attribute["source"] || key
         end
+        attributes
       else
-        attributes.collect! do |attribute|
+        attributes.collect do |attribute|
           if attribute.is_a?(Hash)
             attribute["source"] || attribute["label"]
           else
@@ -206,6 +205,13 @@ module Droonga
           end
         end
       end
+    end
+
+    def collect_sort_attributes(attributes, sort_keys)
+      sort_keys ||= []
+      sort_keys = sort_keys["keys"] || [] if sort_keys.is_a?(Hash)
+
+      attributes = collect_source_column_names(attributes)
 
       sort_attributes = sort_keys.collect do |key|
         key = key[1..-1] if key[0] == "-"
-------------- next part --------------
HTML����������������������������...
Download 



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