Module: ThinkingSphinx::Deltas::ResqueDelta::IndexUtils

Extended by:
IndexUtils
Included in:
IndexUtils
Defined in:
lib/thinking_sphinx/deltas/resque_delta/index_utils.rb

Instance Method Summary collapse

Instance Method Details

#core_indicesObject



16
17
18
# File 'lib/thinking_sphinx/deltas/resque_delta/index_utils.rb', line 16

def core_indices
  @core_indices ||= indices.select { |i| i =~ /_core$/ }
end

#core_to_delta(core_name) ⇒ Object



32
33
34
# File 'lib/thinking_sphinx/deltas/resque_delta/index_utils.rb', line 32

def core_to_delta(core_name)
  core_name.sub(/_core$/, '_delta')
end

#delta_indicesObject



20
21
22
# File 'lib/thinking_sphinx/deltas/resque_delta/index_utils.rb', line 20

def delta_indices
  @delta_indices ||= indices.select { |i| i =~ /_delta$/ }
end

#delta_to_core(delta_name) ⇒ Object



28
29
30
# File 'lib/thinking_sphinx/deltas/resque_delta/index_utils.rb', line 28

def delta_to_core(delta_name)
  delta_name.sub(/_delta$/, '_core')
end

#index_prefixesObject

Public: Return a list of index prefixes (i.e. without “_core”/“_delta”).

Examples

sphinx_indices
# => ['foo', 'bar']

Returns an Array of index prefixes.



12
13
14
# File 'lib/thinking_sphinx/deltas/resque_delta/index_utils.rb', line 12

def index_prefixes
  @prefixes ||= indices.reject { |i| i =~ /_(core|delta)$/ }
end

#reload!Object



24
25
26
# File 'lib/thinking_sphinx/deltas/resque_delta/index_utils.rb', line 24

def reload!
  @ts_config = @indices = @prefixes = @core_indices = @delta_indices = nil
end

#ts_configObject



36
37
38
39
40
# File 'lib/thinking_sphinx/deltas/resque_delta/index_utils.rb', line 36

def ts_config
  @ts_config ||= ThinkingSphinx::Configuration.instance.tap do |config|
    config.generate
  end
end