Skip to content

Commit

Permalink
Apply limit only for "sum" or "sort"
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jan 24, 2014
1 parent 0f8b9eb commit d444d9f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/droonga/plugin/collector/basic.rb
Expand Up @@ -51,16 +51,18 @@ def reduce(deal, left_value, right_value)
reduced_value = left_value && right_value
when "sum"
reduced_value = left_value + right_value
reduced_value = apply_output_range(reduced_value,
"limit" => deal["limit"])
when "average"
reduced_value = (left_value + right_value) / 2
when "sort"
reduced_value = merge(left_value,
right_value,
:operators => deal["operators"],
:key_column => deal["key_column"])
reduced_value = apply_output_range(reduced_value,
"limit" => deal["limit"])
end

reduced_value = apply_output_range(reduced_value, "limit" => deal["limit"])
end

def apply_output_range(items, output)
Expand Down

0 comments on commit d444d9f

Please sign in to comment.