Class: DataMapper::Adapters::Sphinx::ManagedClient
- Defined in:
- lib/dm-sphinx-adapter/client.rb
Overview
Managed searchd if you don’t already have god/monit doing the job for you.
Requires you have daemon_controller
installed.
See
Instance Method Summary collapse
-
#initialize(url_or_options = {}) ⇒ ManagedClient
constructor
See * DataMapper::Adapters::Sphinx::Client#new.
-
#search(*args) ⇒ Object
Start the
searchd
daemon if it isn’t already running then search. -
#stop ⇒ Object
Stop the
searchd
daemon if it’s running.
Methods inherited from Client
Constructor Details
#initialize(url_or_options = {}) ⇒ ManagedClient
See
-
DataMapper::Adapters::Sphinx::Client#new
80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/dm-sphinx-adapter/client.rb', line 80 def initialize( = {}) super require 'daemon_controller' @client = DaemonController.new( :identifier => 'Sphinx searchd', :start_command => @config.searchd_bin, :stop_command => "#{@config.searchd_bin} --stop", :ping_command => method(:running?), :pid_file => @config.pid_file, :log_file => @config.log ) end |
Instance Method Details
#search(*args) ⇒ Object
Start the searchd
daemon if it isn’t already running then search.
See
-
DataMapper::Adapters::Sphinx::Client#search
98 99 100 |
# File 'lib/dm-sphinx-adapter/client.rb', line 98 def search(*args) @client.connect{super} end |
#stop ⇒ Object
Stop the searchd
daemon if it’s running.
103 104 105 |
# File 'lib/dm-sphinx-adapter/client.rb', line 103 def stop @client.stop if @client.running? end |