Sha256: 70bafd75249bb4329fe54ff83cf7a852bd718d9cf4ae94c5ecbd79cd751cae0a

Contents?: true

Size: 565 Bytes

Versions: 2

Compression:

Stored size: 565 Bytes

Contents

class ThinkingSphinx::Controller < Riddle::Controller
  def index(*indices)
    options = indices.extract_options!
    indices << '--all' if indices.empty?

    indices = indices.reject { |index| File.exists? guard_file(index) }
    return if indices.empty?

    indices.each { |index| FileUtils.touch guard_file(index) }
    super(*(indices + [options]))
    indices.each { |index| FileUtils.rm guard_file(index) }
  end

  def guard_file(index)
    File.join(
      ThinkingSphinx::Configuration.instance.indices_location,
      "ts-#{index}.tmp"
    )
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thinking-sphinx-3.1.1 lib/thinking_sphinx/controller.rb
thinking-sphinx-3.1.0 lib/thinking_sphinx/controller.rb