[Groonga-commit] droonga/fluent-plugin-droonga at ea77da8 [master] Unify all columns except "_key"

Zurück zum Archiv-Index

YUKI Hiroshi null+****@clear*****
Wed Dec 4 15:57:57 JST 2013


YUKI Hiroshi	2013-12-04 15:57:57 +0900 (Wed, 04 Dec 2013)

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

  Message:
    Unify all columns except "_key"

  Modified files:
    lib/droonga/plugin/collector/basic.rb
    lib/droonga/plugin/distributor/search.rb
    test/unit/plugin/collector/test_basic.rb

  Modified: lib/droonga/plugin/collector/basic.rb (+3 -7)
===================================================================
--- lib/droonga/plugin/collector/basic.rb    2013-12-04 15:27:51 +0900 (705ee42)
+++ lib/droonga/plugin/collector/basic.rb    2013-12-04 15:57:57 +0900 (bd6a8e1)
@@ -96,8 +96,7 @@ module Droonga
           reduced_values = merge(values[0][key],
                                  values[1][key],
                                  :operators => deal["operators"],
-                                 :key_column => deal["key_column"],
-                                 :unified_columns => deal["unified_columns"])
+                                 :key_column => deal["key_column"])
         end
 
         reduced_values = apply_output_range(reduced_values, "limit" => deal["limit"])
@@ -165,11 +164,8 @@ module Droonga
         rest_unified_items.any? do |unified_item|
           if unified_item[key_column_index] == key
             base_item.each_with_index do |value, column|
-              if options[:unified_columns].include?(column)
-                unified_item[column] += value
-              else
-                unified_item[column] ||= value
-              end
+              next if column == key_column_index
+              unified_item[column] += value
             end
             rest_unified_items -= [unified_item]
             true

  Modified: lib/droonga/plugin/distributor/search.rb (+0 -8)
===================================================================
--- lib/droonga/plugin/distributor/search.rb    2013-12-04 15:27:51 +0900 (379b653)
+++ lib/droonga/plugin/distributor/search.rb    2013-12-04 15:57:57 +0900 (c309e63)
@@ -260,7 +260,6 @@ module Droonga
 
     ASCENDING_OPERATOR = "<".freeze
     DESCENDING_OPERATOR = ">".freeze
-    MERGE_ATTRIBUTES = ["_nsubrecs", "_subrecs"]
 
     def sort_reducer(params={})
       attributes = params[:attributes] || []
@@ -268,12 +267,6 @@ module Droonga
       sort_keys = sort_keys["keys"] || [] if sort_keys.is_a?(Hash)
 
       key_column_index = attributes.index("_key")
-      unified_columns = []
-      attributes.each_with_index do |attribute, index|
-        source = attribute
-        source = attribute["source"] if attribute.is_a?(Hash)
-        unified_columns << index if MERGE_ATTRIBUTES.include?(source)
-      end
 
       operators = sort_keys.collect do |sort_key|
         operator = ASCENDING_OPERATOR
@@ -293,7 +286,6 @@ module Droonga
       }
       if params[:unify_by_key] && !key_column_index.nil?
         reducer["key_column"] = key_column_index
-        reducer["unified_columns"] = unified_columns unless unified_columns.empty?
       end
       reducer
     end

  Modified: test/unit/plugin/collector/test_basic.rb (+0 -1)
===================================================================
--- test/unit/plugin/collector/test_basic.rb    2013-12-04 15:27:51 +0900 (833568d)
+++ test/unit/plugin/collector/test_basic.rb    2013-12-04 15:57:57 +0900 (d4b4ad1)
@@ -605,7 +605,6 @@ class BasicCollectorTest < Test::Unit::TestCase
                       { "column" => 1, "operator" => "<" },
                     ],
                     "key_column" => 0,
-                    "unified_columns" => [1, 2],
                     "limit" => -1,
                   },
                 },
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index