From ae0ea64e438bdbd503d4ae50a0d98c8364d5f44b Mon Sep 17 00:00:00 2001 From: elz Date: Sun, 14 Sep 2014 18:59:35 -0400 Subject: [PATCH] Give the batch size a name --- app/models/search/indexer.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/search/indexer.rb b/app/models/search/indexer.rb index 52aa1d68e4b..90aaddb49f9 100644 --- a/app/models/search/indexer.rb +++ b/app/models/search/indexer.rb @@ -1,5 +1,7 @@ class Indexer + BATCH_SIZE = 1000 + ################## # CLASS METHODS ################## @@ -52,9 +54,9 @@ def self.index_all(options={}) end def self.index_from_db - total = (indexables.count / 1000) + 1 + total = (indexables.count / BATCH_SIZE) + 1 i = 1 - indexables.find_in_batches do |group| + indexables.find_in_batches(batch_size: BATCH_SIZE) do |group| puts "Reindexing #{klass} batch #{i} of #{total}" self.new(group.map(&:id)).index_documents i += 1