YUKI Hiroshi
null+****@clear*****
Wed Dec 4 19:01:26 JST 2013
YUKI Hiroshi 2013-12-04 19:01:26 +0900 (Wed, 04 Dec 2013) New Revision: 45e189f98607f9257ca86b973dda3ddc375102ef https://github.com/droonga/fluent-plugin-droonga/commit/45e189f98607f9257ca86b973dda3ddc375102ef Message: Prepare to store multiple mappers for the gatherer Modified files: lib/droonga/plugin/collector/basic.rb lib/droonga/plugin/distributor/search.rb Modified: lib/droonga/plugin/collector/basic.rb (+9 -4) =================================================================== --- lib/droonga/plugin/collector/basic.rb 2013-12-04 18:41:43 +0900 (bd6a8e1) +++ lib/droonga/plugin/collector/basic.rb 2013-12-04 19:01:26 +0900 (149c6a6) @@ -27,10 +27,15 @@ module Droonga def collector_gather(result) output = body ? body[input_name] : input_name if output.is_a?(Hash) - element = output["element"] - if element - result[element] = apply_output_range(result[element], output) - result[element] = apply_output_attributes_and_format(result[element], output) + elements = output["elements"] + if elements && elements.is_a?(Hash) + elements.each do |element, mapper| + case mapper["type"] + when "sort" + result[element] = apply_output_range(result[element], mapper) + result[element] = apply_output_attributes_and_format(result[element], mapper) + end + end end output = output["output"] end Modified: lib/droonga/plugin/distributor/search.rb (+8 -5) =================================================================== --- lib/droonga/plugin/distributor/search.rb 2013-12-04 18:41:43 +0900 (c320f28) +++ lib/droonga/plugin/distributor/search.rb 2013-12-04 19:01:26 +0900 (153df1f) @@ -47,6 +47,7 @@ module Droonga output_names << output_name output_mapper[output_name] = { "output" => input_name, + "elements" => {}, } # The collector module supports only "simple" format search results. @@ -88,11 +89,13 @@ module Droonga # Instead, we apply "offset" on the gethering phase. elements[element]["limit"] = output["limit"] - output_mapper[output_name]["element"] = element - output_mapper[output_name]["offset"] = final_offset - output_mapper[output_name]["limit"] = final_limit - output_mapper[output_name]["format"] = final_format - output_mapper[output_name]["attributes"] = final_attributes + output_mapper[output_name]["elements"][element] = { + "type" => "sort", + "offset" => final_offset, + "limit" => final_limit, + "format" => final_format, + "attributes" => final_attributes, + } end end -------------- next part -------------- HTML����������������������������...Download