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

  command :prepare
end

Public Instance Methods

clear() click to toggle source
# File lib/thinking_sphinx/interfaces/real_time.rb, line 12
def clear
  command :clear_real_time, :indices => indices
end
index() click to toggle source
# File lib/thinking_sphinx/interfaces/real_time.rb, line 16
  def index
    return if indices.empty?
    if !command :running
      stream.puts <<-TXT
The Sphinx daemon is not currently running. Real-time indices can only be
populated by sending commands to a running daemon.
      TXT
      return
    end

    command :index_real_time, :indices => indices
  end

Private Instance Methods

index_names() click to toggle source
# File lib/thinking_sphinx/interfaces/real_time.rb, line 31
def index_names
  @index_names ||= options[:index_names] || []
end
indices() click to toggle source
# File lib/thinking_sphinx/interfaces/real_time.rb, line 35
def indices
  @indices ||= begin
    indices = configuration.indices.select { |index| index.type == 'rt' }

    if index_names.any?
      indices.select! { |index| index_names.include? index.name }
    end

    indices
  end
end