Navigation Menu

Skip to content

Commit

Permalink
Support :max_n_sub_records option.
Browse files Browse the repository at this point in the history
  • Loading branch information
daijiro committed Jun 21, 2013
1 parent 6de5280 commit 055c256
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/droonga/plugin/handler_search.rb
Expand Up @@ -203,7 +203,15 @@ def search_query(results)
@result = source.select(expression)
end
if @query["groupBy"]
@result = @result.group(@query["groupBy"])
if @query["groupBy"].is_a? String
@result = @result.group(@query["groupBy"])
elseif @query["groupBy"].is_a? Hash
key = @query["groupBy"]["key"]
max_n_sub_records = @query["groupBy"]["maxNumSubRecords"]
@result = @result.group(key, :max_n_sub_records => max_n_sub_records)
else
raise '"groupBy" parameter must be a Hash or a String'
end
end
@count = @result.size
if @query["sortBy"]
Expand Down

0 comments on commit 055c256

Please sign in to comment.