Sha256: 4d55f9aedf68b1ea3b65e041a8da79e289e46121fde0d184f0de6d5649f6c6d9

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

class SphinxController
  def initialize
    if config.respond_to?(:searchd)
      config.searchd.mysql41 = 9307
    else
      config.port = 9313
    end
  end

  def setup
    if config.respond_to?(:searchd)
      FileUtils.mkdir_p config.indices_location

      config.render_to_file && index

      ThinkingSphinx::Configuration.reset
    else
      FileUtils.mkdir_p config.searchd_file_path

      config.build
      config.controller.index

      ThinkingSphinx::Configuration.instance.reset
    end

    ActiveSupport::Dependencies.clear

    if config.respond_to?(:searchd)
      config.index_paths.each do |path|
        Dir["#{path}/**/*.rb"].each { |file| $LOADED_FEATURES.delete file }
      end

      config.searchd.mysql41 = 9307
      config.settings['quiet_deltas']      = true
      config.settings['attribute_updates'] = true
    else
      config.port = 9313
      ThinkingSphinx.suppress_delta_output = true
      ThinkingSphinx.updates_enabled       = true
      ThinkingSphinx.deltas_enabled        = true
    end
  end

  def start
    config.controller.start
  end

  def stop
    config.controller.stop
  end

  def index(*indices)
    config.controller.index *indices
  end

  private

  def config
    ThinkingSphinx::Configuration.instance
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ts-resque-delta-2.1.0 spec/acceptance/support/sphinx_controller.rb
ts-delayed-delta-2.1.0 spec/acceptance/support/sphinx_controller.rb
ts-delayed-delta-2.0.2 spec/acceptance/support/sphinx_controller.rb
ts-resque-delta-2.0.0 spec/acceptance/support/sphinx_controller.rb
ts-delayed-delta-2.0.1 spec/acceptance/support/sphinx_controller.rb
ts-delayed-delta-2.0.0 spec/acceptance/support/sphinx_controller.rb