autostop()
click to toggle source
def self.autostop
Kernel.at_exit do
ThinkingSphinx::Test.stop
end
end
config()
click to toggle source
def self.config
@config ||= ::ThinkingSphinx::Configuration.instance
end
create_indexes_folder()
click to toggle source
def self.create_indexes_folder
FileUtils.mkdir_p config.searchd_file_path
end
index(*indexes)
click to toggle source
def self.index(*indexes)
config.controller.index *indexes
end
init(suppress_delta_output = true)
click to toggle source
def self.init(suppress_delta_output = true)
set_flags suppress_delta_output
create_indexes_folder
end
run() { || ... }
click to toggle source
def self.run(&block)
begin
start
yield
ensure
stop
end
end
set_flags(suppress_delta_output)
click to toggle source
def self.set_flags(suppress_delta_output)
::ThinkingSphinx.deltas_enabled = true
::ThinkingSphinx.updates_enabled = true
::ThinkingSphinx.suppress_delta_output = suppress_delta_output
end
start()
click to toggle source
def self.start
config.build
config.controller.index
config.controller.start
end
start_with_autostop()
click to toggle source
def self.start_with_autostop
autostop
start
end
stop()
click to toggle source
def self.stop
config.controller.stop
sleep(0.5)
end