Class: ThinkingSphinx::Deltas::DeltaJob
- Inherits:
-
Object
- Object
- ThinkingSphinx::Deltas::DeltaJob
- Defined in:
- lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb
Overview
A simple job class that processes a given index.
Instance Attribute Summary collapse
-
#indices ⇒ Object
Returns the value of attribute indices.
Instance Method Summary collapse
-
#display_name ⇒ Object
Shows index name in Delayed::Job#name.
-
#initialize(indices) ⇒ DeltaJob
constructor
Initialises the object with an index name.
-
#perform ⇒ Boolean
Runs Sphinx’s indexer tool to process the index.
Constructor Details
#initialize(indices) ⇒ DeltaJob
Initialises the object with an index name.
10 11 12 |
# File 'lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb', line 10 def initialize(indices) @indices = indices end |
Instance Attribute Details
#indices ⇒ Object
Returns the value of attribute indices.
4 5 6 |
# File 'lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb', line 4 def indices @indices end |
Instance Method Details
#display_name ⇒ Object
Shows index name in Delayed::Job#name.
16 17 18 |
# File 'lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb', line 16 def display_name "#{self.class.name} for #{indices.join(', ')}" end |
#perform ⇒ Boolean
Runs Sphinx’s indexer tool to process the index. Currently assumes Sphinx is running.
25 26 27 28 29 30 31 32 |
# File 'lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb', line 25 def perform config = ThinkingSphinx::Configuration.instance output = `#{config.bin_path}#{config.indexer_binary_name} --config "#{config.config_file}" --rotate #{indices.join(' ')}` puts output unless ThinkingSphinx.suppress_delta_output? true end |