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

Version Path
searchkick-5.4.0 lib/searchkick/process_batch_job.rb
searchkick-5.3.1 lib/searchkick/process_batch_job.rb
searchkick-5.3.0 lib/searchkick/process_batch_job.rb
searchkick-5.2.4 lib/searchkick/process_batch_job.rb
searchkick-5.2.3 lib/searchkick/process_batch_job.rb
searchkick-5.2.2 lib/searchkick/process_batch_job.rb
searchkick-5.2.1 lib/searchkick/process_batch_job.rb
searchkick-5.2.0 lib/searchkick/process_batch_job.rb
searchkick-5.1.2 lib/searchkick/process_batch_job.rb
searchkick-5.1.1 lib/searchkick/process_batch_job.rb
searchkick-5.1.0 lib/searchkick/process_batch_job.rb
searchkick-5.0.5 lib/searchkick/process_batch_job.rb
searchkick-5.0.4 lib/searchkick/process_batch_job.rb
searchkick-5.0.3 lib/searchkick/process_batch_job.rb
searchkick-5.0.2 lib/searchkick/process_batch_job.rb
searchkick-5.0.1 lib/searchkick/process_batch_job.rb
searchkick-5.0.0 lib/searchkick/process_batch_job.rb