Class: ThinkingSphinx::Deltas::DeltaJob

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(indexes) ⇒ DeltaJob

Initialises the object with an index name.

Parameters:

  • index (String)

    the name of the Sphinx index



10
11
12
# File 'lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb', line 10

def initialize(indexes)
  @indexes = indexes
end

Instance Attribute Details

#indexesObject

Returns the value of attribute indexes.



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

def indexes
  @indexes
end

Instance Method Details

#performBoolean

Runs Sphinx’s indexer tool to process the index. Currently assumes Sphinx is running.

Returns:

  • (Boolean)

    true



19
20
21
22
23
24
25
26
# File 'lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb', line 19

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