Skip to content

Commit

Permalink
Fix bug where custom batch size was ignored.
Browse files Browse the repository at this point in the history
Thanks @jonathanhoskin for bringing this to my attention in sunspot#594.
  • Loading branch information
njakobsen committed Sep 20, 2015
1 parent adbc197 commit 327c7e4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sunspot_rails/lib/sunspot/rails/searchable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,7 @@ def solr_index(opts={})
#
# ==== Options (passed as a hash)
#
# batch_size<Integer>:: Batch size with which to load records. Passing
# Default is 1000 (from ActiveRecord).
# batch_size<Integer>:: Override default batch size with which to load records.
#
# ==== Returns
#
Expand All @@ -294,7 +293,7 @@ def solr_index_orphans(opts={})
solr_page = 0
solr_ids = []
while (solr_page = solr_page.next)
ids = solr_search_ids { paginate(:page => solr_page, :per_page => 1000) }.to_a
ids = solr_search_ids { paginate(:page => solr_page, :per_page => batch_size) }.to_a
break if ids.empty?
solr_ids.concat ids
end
Expand All @@ -310,8 +309,7 @@ def solr_index_orphans(opts={})
#
# ==== Options (passed as a hash)
#
# batch_size<Integer>:: Batch size with which to load records
# Default is 50
# batch_size<Integer>:: Override default batch size with which to load records
#
def solr_clean_index_orphans(opts={})
solr_index_orphans(opts).each do |id|
Expand Down

0 comments on commit 327c7e4

Please sign in to comment.