YUKI Hiroshi
null+****@clear*****
Thu Dec 5 13:17:23 JST 2013
YUKI Hiroshi 2013-12-05 13:17:23 +0900 (Thu, 05 Dec 2013) New Revision: 120f9310eb2696089b1fc268ff21f198f6b7da01 https://github.com/droonga/fluent-plugin-droonga/commit/120f9310eb2696089b1fc268ff21f198f6b7da01 Message: Detect no reducing case correctly for no output of count and records Modified files: lib/droonga/plugin/distributor/distributed_search_plan.rb Modified: lib/droonga/plugin/distributor/distributed_search_plan.rb (+9 -8) =================================================================== --- lib/droonga/plugin/distributor/distributed_search_plan.rb 2013-12-05 13:14:08 +0900 (b31dcde) +++ lib/droonga/plugin/distributor/distributed_search_plan.rb 2013-12-05 13:17:23 +0900 (ecd5e92) @@ -82,7 +82,8 @@ module Droonga # Skip reducing phase for a result with no output. if output.nil? or output["elements"].nil? or - (output["elements"] - ["count", "recors"]).empty? + (!output["elements"].include?("count") && + !output["elements"].include?("records")) return end @@ -102,11 +103,11 @@ module Droonga final_offset, final_limit = calculate_offset_and_limit!(query) - elements = {} + output_elements = {} no_output_records = false if output["elements"].include?("count") - elements["count"] = { + output_elements["count"] = { "type" => "sum", } if output["unifiable"] @@ -141,14 +142,14 @@ module Droonga output["attributes"] << "_key" end - elements["records"] = sort_reducer(:attributes => output["attributes"], - :sort_keys => query["sortBy"], - :unifiable => unifiable) + output_elements["records"] = sort_reducer(:attributes => output["attributes"], + :sort_keys => query["sortBy"], + :unifiable => unifiable) # On the reducing phase, we apply only "limit". We cannot apply # "offset" on this phase because the collecter merges a pair of # results step by step even if there are three or more results. # Instead, we apply "offset" on the gethering phase. - elements["records"]["limit"] = output["limit"] + output_elements["records"]["limit"] = output["limit"] records_mapper = { "type" => "sort", @@ -165,7 +166,7 @@ module Droonga "type" => "reduce", "body" => { input_name => { - output_name => elements, + output_name => output_elements, }, }, "inputs" => [input_name], # XXX should be placed in the "body"? -------------- next part -------------- HTML����������������������������...Download