YUKI Hiroshi
null+****@clear*****
Fri Jan 31 15:45:06 JST 2014
YUKI Hiroshi 2014-01-31 15:45:06 +0900 (Fri, 31 Jan 2014) New Revision: cf950e3a9fb633512737d8e0e2ae2b2828924282 https://github.com/droonga/fluent-plugin-droonga/commit/cf950e3a9fb633512737d8e0e2ae2b2828924282 Message: Simplify. The old implementation was too robust. Modified files: lib/droonga/plugin/collector/search.rb Modified: lib/droonga/plugin/collector/search.rb (+11 -14) =================================================================== --- lib/droonga/plugin/collector/search.rb 2014-01-31 15:40:38 +0900 (43adc65) +++ lib/droonga/plugin/collector/search.rb 2014-01-31 15:45:06 +0900 (3ad4060) @@ -54,21 +54,18 @@ module Droonga end def apply_output_attributes_and_format(items, output) - attributes = output["attributes"] - if attributes - format = output["format"] - if format == "complex" - items.collect! do |item| - complex_item = {} - attributes.each_with_index do |label, index| - complex_item[label] = item[index] - end - complex_item - end - else - items.collect! do |item| - item[0...attributes.size] + attributes = output["attributes"] || [] + if output["format"] == "complex" + items.collect! do |item| + complex_item = {} + attributes.each_with_index do |label, index| + complex_item[label] = item[index] end + complex_item + end + else + items.collect! do |item| + item[0...attributes.size] end end items -------------- next part -------------- HTML����������������������������...Download