Sha256: 6443b8f7300afa386e9940075a7b737f33902c8b93f82ea16e19b964724f12ac
Contents?: true
Size: 594 Bytes
Versions: 17
Compression:
Stored size: 594 Bytes
Contents
module Searchkick class ProcessBatchJob < ActiveJob::Base queue_as { Searchkick.queue_name } def perform(class_name:, record_ids:, index_name: nil) model = Searchkick.load_model(class_name) index = model.searchkick_index(name: index_name) items = record_ids.map do |r| parts = r.split(/(?<!\|)\|(?!\|)/, 2) .map { |v| v.gsub("||", "|") } {id: parts[0], routing: parts[1]} end relation = Searchkick.scope(model) RecordIndexer.new(index).reindex_items(relation, items, method_name: nil) end end end
Version data entries
17 entries across 17 versions & 1 rubygems