Class: ThinkingSphinx::Deltas::DeltaJob

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index) ⇒ DeltaJob

Returns a new instance of DeltaJob.



6
7
8
# File 'lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb', line 6

def initialize(index)
  @index = index
end

Instance Attribute Details

#indexObject

Returns the value of attribute index.



4
5
6
# File 'lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb', line 4

def index
  @index
end

Instance Method Details

#performObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb', line 10

def perform
  return true unless ThinkingSphinx.updates_enabled? &&
    ThinkingSphinx.deltas_enabled?
  
  config = ThinkingSphinx::Configuration.instance
  client = Riddle::Client.new config.address, config.port
  
  output = `#{config.bin_path}indexer --config #{config.config_file} --rotate #{index}`
  puts output unless ThinkingSphinx.suppress_delta_output?
  
  true
end