Sha256: 2aae277ca5c62b49d28ccfb16295d695fd4cf1949246dd21ec6e66af730ddd8b

Contents?: true

Size: 727 Bytes

Versions: 17

Compression:

Stored size: 727 Bytes

Contents

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

    def perform(class_name, id, method_name = nil, routing: nil, index_name: nil)
      model = Searchkick.load_model(class_name, allow_child: true)
      index = model.searchkick_index(name: index_name)
      # use should_index? to decide whether to index (not default scope)
      # just like saving inline
      # could use Searchkick.scope() in future
      # but keep for now for backwards compatibility
      model = model.unscoped if model.respond_to?(:unscoped)
      items = [{id: id, routing: routing}]
      RecordIndexer.new(index).reindex_items(model, items, method_name: method_name, single: true)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

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