class ThinkingSphinx::Interfaces::SQL

Public Class Methods

new(configuration, options, stream = STDOUT) click to toggle source
Calls superclass method ThinkingSphinx::WithOutput::new
# File lib/thinking_sphinx/interfaces/sql.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/sql.rb, line 12
def clear
  command :clear_sql, :indices => (filtered? ? filtered_indices : indices)
end
index(reconfigure = true, verbose = nil) click to toggle source
# File lib/thinking_sphinx/interfaces/sql.rb, line 16
  def index(reconfigure = true, verbose = nil)
    stream.puts <<-TXT unless verbose.nil?
The verbose argument to the index method is now deprecated, and can instead be
managed by the :verbose option passed in when initialising RakeInterface. That
option is set automatically when invoked by rake, via rake's --silent and/or
--quiet arguments.
    TXT
    return if indices.empty?

    command :configure if reconfigure
    command :index_sql,
      :indices => (filtered? ? filtered_indices.collect(&:name) : nil)
  end
merge() click to toggle source
# File lib/thinking_sphinx/interfaces/sql.rb, line 30
def merge
  command :merge_and_update
end

Private Instance Methods

filtered?() click to toggle source
# File lib/thinking_sphinx/interfaces/sql.rb, line 36
def filtered?
  index_names.any?
end
filtered_indices() click to toggle source
# File lib/thinking_sphinx/interfaces/sql.rb, line 40
def filtered_indices
  indices.select { |index| index_names.include? index.name }
end
index_names() click to toggle source
# File lib/thinking_sphinx/interfaces/sql.rb, line 44
def index_names
  @index_names ||= options[:index_names] || []
end
indices() click to toggle source
# File lib/thinking_sphinx/interfaces/sql.rb, line 48
def indices
  @indices ||= configuration.indices.select do |index|
    index.type == 'plain' || index.type.blank?
  end
end