YUKI Hiroshi
null+****@clear*****
Thu Nov 28 13:35:50 JST 2013
YUKI Hiroshi 2013-11-28 13:35:50 +0900 (Thu, 28 Nov 2013) New Revision: 1ebd01236fb161fd23ae61700a7efad1811e50f4 https://github.com/droonga/fluent-plugin-droonga/commit/1ebd01236fb161fd23ae61700a7efad1811e50f4 Message: Give offset and limit to gatherer instead of each reducer Modified files: lib/droonga/plugin/distributor/search.rb Modified: lib/droonga/plugin/distributor/search.rb (+10 -8) =================================================================== --- lib/droonga/plugin/distributor/search.rb 2013-11-28 13:39:25 +0900 (cf62b1e) +++ lib/droonga/plugin/distributor/search.rb 2013-11-28 13:35:50 +0900 (ddef1e4) @@ -26,7 +26,7 @@ module Droonga message = [] input_names = [] output_names = [] - name_mapper = {} + output_mapper = {} request = envelope["body"] request["queries"].each do |input_name, query| output = query["output"] @@ -35,7 +35,9 @@ module Droonga input_names << input_name output_name = input_name + "_reduced" output_names << output_name - name_mapper[output_name] = input_name + output_mapper[output_name] = { + "source" => input_name, + } final_offset, final_limit = calculate_offset_and_limit!(query) @@ -50,8 +52,8 @@ module Droonga # TODO: must take "sortBy" section into account. elements[element] = sort_reducer(:attributes => query["attributes"], :sort_keys => query["sortBy"]) - elements[element]["offset"] = final_offset - elements[element]["limit"] = final_limit + output_mapper[output_name]["offset"] = final_offset + output_mapper[output_name]["limit"] = final_limit end end @@ -60,17 +62,17 @@ module Droonga "outputs" => [output_name], "type" => "reduce", "body" => { - input_name=> { - output_name=> elements, + input_name => { + output_name => elements, }, }, } message << reducer end gatherer = { - "inputs" => output_names, "type" => "gather", - "body" => name_mapper, + "body" => output_mapper, + "inputs" => output_names, "post" => true, } message << gatherer -------------- next part -------------- HTML����������������������������...Download