Sha256: 9c8b71ef9a3a8d0045fceb6fe85adb1692cb40ee337e0051bbd31aa2670f4466
Contents?: true
Size: 568 Bytes
Versions: 3
Compression:
Stored size: 568 Bytes
Contents
module Searchkick class ReindexV2Job < ActiveJob::Base queue_as :searchkick def perform(klass, id) model = klass.constantize record = model.find(id) rescue nil # TODO fix lazy coding index = model.searchkick_index if !record || !record.should_index? # hacky record ||= model.new record.id = id begin index.remove record rescue Elasticsearch::Transport::Transport::Errors::NotFound # do nothing end else index.store record end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
searchkick-0.9.1 | lib/searchkick/reindex_v2_job.rb |
searchkick-sinneduy-0.9.0 | lib/searchkick/reindex_v2_job.rb |
searchkick-0.9.0 | lib/searchkick/reindex_v2_job.rb |