Sha256: 675cf675a25b177bed550e8504674de51617214a7a8eb0cdcb1a5253a30f2109

Contents?: true

Size: 801 Bytes

Versions: 3

Compression:

Stored size: 801 Bytes

Contents

require 'thinking_sphinx/deltas/resque_delta'

class FlyingSphinx::ResqueDelta < ThinkingSphinx::Deltas::ResqueDelta
  def self.job_types
    [
      FlyingSphinx::ResqueDelta::DeltaJob,
      FlyingSphinx::ResqueDelta::FlagAsDeletedJob
    ]
  end

  def self.job_prefix
    'fs-delta'
  end

  def index(model, instance = nil)
    return true if skip?(instance)

    model.delta_index_names.each do |delta|
      next if self.class.locked?(delta)

      Resque.enqueue FlyingSphinx::ResqueDelta::DeltaJob, delta
    end

    Resque.enqueue(
      FlyingSphinx::ResqueDelta::FlagAsDeletedJob,
      model.core_index_names,
      instance.sphinx_document_id
    ) if instance

    true
  end
end

require 'flying_sphinx/resque_delta/delta_job'
require 'flying_sphinx/resque_delta/flag_as_deleted_job'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ts-resque-delta-1.2.4 lib/flying_sphinx/resque_delta.rb
ts-resque-delta-1.2.3 lib/flying_sphinx/resque_delta.rb
ts-resque-delta-1.2.2 lib/flying_sphinx/resque_delta.rb