From 013ef3cc16c71b86c1f4164f009d3a373a2ebf75 Mon Sep 17 00:00:00 2001 From: Daniel Westendorf Date: Mon, 3 Jul 2017 08:33:04 -0600 Subject: [PATCH] Correctly pass the id of the batch --- lib/searchkick/index.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/searchkick/index.rb b/lib/searchkick/index.rb index 5f5306c..661e7bd 100644 --- a/lib/searchkick/index.rb +++ b/lib/searchkick/index.rb @@ -433,8 +433,9 @@ module Searchkick bulk_reindex_job scope, batch_id, min_id: min_id, max_id: min_id + batch_size - 1 end else - batch_id = 1 - scope.in_batches(of: batch_size).each do |batch| + scope.in_batches(of: batch_size).each_with_index do |batch, i| + batch_id = i + 1 + bulk_reindex_job scope, batch_id, record_ids: batch.pluck(primary_key) end end -- libgit2 0.21.0