Sha256: 7b271f40c2dd840777eefc598593586a0a377826093fc769dc2bba41f31c3d7d

Contents?: true

Size: 829 Bytes

Versions: 4

Compression:

Stored size: 829 Bytes

Contents

# A simple job class that processes a given index.
# 
class ThinkingSphinx::Deltas::DeltaJob
  attr_accessor :indexes
  
  # Initialises the object with an index name.
  # 
  # @param [String] index the name of the Sphinx index
  # 
  def initialize(indexes)
    @indexes = indexes
  end
  
  # Shows index name in Delayed::Job#name.
  # 
  def display_name
    "#{self.class.name} for #{indexes.join(', ')}"
  end
  
  # Runs Sphinx's indexer tool to process the index. Currently assumes Sphinx is
  # running.
  # 
  # @return [Boolean] true
  # 
  def perform
    config = ThinkingSphinx::Configuration.instance
    
    output = `#{config.bin_path}#{config.indexer_binary_name} --config #{config.config_file} --rotate #{indexes.join(' ')}`
    puts output unless ThinkingSphinx.suppress_delta_output?
    
    true
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ts-delayed-delta-1.1.2 lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb
ts-delayed-delta-1.1.1 lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb
ts-delayed-delta-1.1.0 lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb
ts-delayed-delta-1.0.4 lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb