Sha256: a3ea21591f8f11885a3ff8942b5a22fe39ed7334c107eb28e5cdb084a1a67aa9

Contents?: true

Size: 983 Bytes

Versions: 6

Compression:

Stored size: 983 Bytes

Contents

class SphinxController
  def initialize
    config.searchd.mysql41 = 9307
  end

  def setup
    FileUtils.mkdir_p config.indices_location
    config.controller.bin_path = ENV['SPHINX_BIN'] || ''
    config.render_to_file && index

    ThinkingSphinx::Configuration.reset

    ActiveSupport::Dependencies.loaded.each do |path|
      $LOADED_FEATURES.delete "#{path}.rb"
    end

    ActiveSupport::Dependencies.clear

    if ENV['SPHINX_VERSION'].try :[], /2.0.\d/
      ThinkingSphinx::Configuration.instance.settings['utf8'] = false
    end

    config.searchd.mysql41 = 9307
    config.settings['quiet_deltas']      = true
    config.settings['attribute_updates'] = true
    config.controller.bin_path           = ENV['SPHINX_BIN'] || ''
  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 & 1 rubygems

Version Path
thinking-sphinx-3.2.0 spec/acceptance/support/sphinx_controller.rb
thinking-sphinx-3.1.4 spec/acceptance/support/sphinx_controller.rb
thinking-sphinx-3.1.3 spec/acceptance/support/sphinx_controller.rb
thinking-sphinx-3.1.2 spec/acceptance/support/sphinx_controller.rb
thinking-sphinx-3.1.1 spec/acceptance/support/sphinx_controller.rb
thinking-sphinx-3.1.0 spec/acceptance/support/sphinx_controller.rb