FIX: Count the records added, including duplicates

This commit is contained in:
Robin Ward 2016-08-12 17:18:12 -04:00
parent aef954784a
commit ec8622a860

View file

@ -721,8 +721,13 @@ class Search
def aggregate_search(opts = {}) def aggregate_search(opts = {})
post_sql = aggregate_post_sql(opts) post_sql = aggregate_post_sql(opts)
aggregate_posts(post_sql[:default]).each {|p| @results.add(p)} added = 0
if @results.posts.size < @limit aggregate_posts(post_sql[:default]).each do |p|
@results.add(p)
added += 1
end
if added < @limit
aggregate_posts(post_sql[:remaining]).each {|p| @results.add(p) } aggregate_posts(post_sql[:remaining]).each {|p| @results.add(p) }
end end
end end