Yoji Shidara
null+****@clear*****
Thu Dec 5 19:16:36 JST 2013
Yoji Shidara 2013-12-05 19:16:36 +0900 (Thu, 05 Dec 2013) New Revision: 959d108913e6cd012fd68802d1a07f2f471b6ea4 https://github.com/droonga/fluent-plugin-droonga/commit/959d108913e6cd012fd68802d1a07f2f471b6ea4 Message: Extract sort_offset method and preserve it first Modified files: lib/droonga/plugin/distributor/distributed_search_plan.rb Modified: lib/droonga/plugin/distributor/distributed_search_plan.rb (+11 -3) =================================================================== --- lib/droonga/plugin/distributor/distributed_search_plan.rb 2013-12-05 17:18:02 +0900 (3da3aaf) +++ lib/droonga/plugin/distributor/distributed_search_plan.rb 2013-12-05 19:16:36 +0900 (5a527e4) @@ -139,6 +139,8 @@ module Droonga end def calculate_offset_and_limit! + @original_sort_offset = sort_offset + calculate_sort_offset! calculate_output_offset! @@ -179,20 +181,26 @@ module Droonga def calculate_sort_offset! # Offset for workers must be zero, because we have to apply "limit" and # "offset" on the last gathering phase instead of each reducing phase. - @sort_offset = 0 if rich_sort? - @sort_offset = @query["sortBy"]["offset"] || 0 @query["sortBy"]["offset"] = 0 end end + def sort_offset + if rich_sort? + @query["sortBy"]["offset"] || 0 + else + 0 + end + end + def calculate_output_offset! @output_offset = @output["offset"] || 0 @output["offset"] = 0 if has_records? end def final_offset - @sort_offset + @output_offset + @original_sort_offset + @output_offset end def has_records? -------------- next part -------------- HTML����������������������������...Download