Commit 1114f61d9b47220ad175b3312f5fe0aabb4260da
1 parent
4538f8f3
Exists in
master
and in
2 other branches
Restore search_import call like latest release [skip ci]
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
lib/searchkick/bulk_reindex_job.rb
@@ -5,11 +5,15 @@ module Searchkick | @@ -5,11 +5,15 @@ module Searchkick | ||
5 | def perform(class_name:, record_ids: nil, index_name: nil, method_name: nil, batch_id: nil, min_id: nil, max_id: nil) | 5 | def perform(class_name:, record_ids: nil, index_name: nil, method_name: nil, batch_id: nil, min_id: nil, max_id: nil) |
6 | klass = class_name.constantize | 6 | klass = class_name.constantize |
7 | index = index_name ? Searchkick::Index.new(index_name, klass.searchkick_options) : klass.searchkick_index | 7 | index = index_name ? Searchkick::Index.new(index_name, klass.searchkick_options) : klass.searchkick_index |
8 | + | ||
9 | + # legacy | ||
8 | record_ids ||= min_id..max_id | 10 | record_ids ||= min_id..max_id |
9 | - records = Searchkick.load_records(klass, record_ids) | 11 | + |
12 | + relation = Searchkick.load_records(klass, record_ids) | ||
13 | + relation = relation.search_import if relation.respond_to?(:search_import) | ||
10 | 14 | ||
11 | # TODO expose functionality on index | 15 | # TODO expose functionality on index |
12 | - index.send(:record_indexer).reindex(records, mode: :inline, method_name: method_name, full: false) | 16 | + index.send(:record_indexer).reindex(relation, mode: :inline, method_name: method_name, full: false) |
13 | index.send(:relation_indexer).batch_completed(batch_id) if batch_id | 17 | index.send(:relation_indexer).batch_completed(batch_id) if batch_id |
14 | end | 18 | end |
15 | end | 19 | end |