5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/searchkick/bulk_reindex_job.rb', line 5
def perform(class_name:, record_ids: nil, index_name: nil, method_name: nil, batch_id: nil, min_id: nil, max_id: nil, ignore_missing: nil)
model = Searchkick.load_model(class_name)
index = model.searchkick_index(name: index_name)
record_ids ||= min_id..max_id
relation = Searchkick.scope(model)
relation = Searchkick.load_records(relation, record_ids)
relation = relation.search_import if relation.respond_to?(:search_import)
RecordIndexer.new(index).reindex(relation, mode: :inline, method_name: method_name, ignore_missing: ignore_missing, full: false)
RelationIndexer.new(index).batch_completed(batch_id) if batch_id
end
|