Sha256: 95c382ae1665e990b501b6cb123293a8868315f8c94c4e1be13fb721142a6f06

Contents?: true

Size: 806 Bytes

Versions: 17

Compression:

Stored size: 806 Bytes

Contents

module Searchkick
  class BulkReindexJob < ActiveJob::Base
    queue_as { Searchkick.queue_name }

    # TODO remove min_id and max_id in Searchkick 6
    def perform(class_name:, record_ids: nil, index_name: nil, method_name: nil, batch_id: nil, min_id: nil, max_id: nil)
      model = Searchkick.load_model(class_name)
      index = model.searchkick_index(name: index_name)

      # legacy
      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, full: false)
      RelationIndexer.new(index).batch_completed(batch_id) if batch_id
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

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