class ThinkingSphinx::Interfaces::RealTime

Public Class Methods

new(configuration, options, stream = STDOUT) click to toggle source
Calls superclass method ThinkingSphinx::WithOutput::new
# File lib/thinking_sphinx/interfaces/real_time.rb, line 4
def initialize(configuration, options, stream = STDOUT)
  super

  configuration.preload_indices

  FileUtils.mkdir_p configuration.indices_location
end

Public Instance Methods

clear() click to toggle source
# File lib/thinking_sphinx/interfaces/real_time.rb, line 12
def clear
  indices.each do |index|
    index.render
    Dir["#{index.path}.*"].each { |path| FileUtils.rm path }
  end

  path = configuration.searchd.binlog_path
  FileUtils.rm_r(path) if File.exists?(path)
end
index() click to toggle source
# File lib/thinking_sphinx/interfaces/real_time.rb, line 22
def index
  return if indices.empty? || !configuration.controller.running?

  indices.each { |index| ThinkingSphinx::RealTime::Populator.populate index }
end

Private Instance Methods

indices() click to toggle source
# File lib/thinking_sphinx/interfaces/real_time.rb, line 30
def indices
  @indices ||= begin
    indices = configuration.indices.select { |index| index.type == 'rt' }

    if options[:index_filter]
      indices.select! { |index| index.name == options[:index_filter] }
    end

    indices
  end
end