Sha256: d1f941cb8f3ffdaa217a79ac3e432c002784a19fdd26c8c24c2fc7706a7efcd8

Contents?: true

Size: 652 Bytes

Versions: 4

Compression:

Stored size: 652 Bytes

Contents

class ThinkingSphinx::Search::Merger
  def initialize(search)
    @search = search
  end

  def merge!(query = nil, options = {})
    query, options = nil, query if query.is_a?(Hash)
    @search.query  = query unless query.nil?

    options.each do |key, value|
      case key
      when :conditions, :with, :without, :with_all, :without_all
        @search.options[key] ||= {}
        @search.options[key].merge! value
      when :without_ids, :classes
        @search.options[key] ||= []
        @search.options[key] += value
        @search.options[key].uniq!
      else
        @search.options[key] = value
      end
    end

    @search
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thinking-sphinx-3.0.2 lib/thinking_sphinx/search/merger.rb
thinking-sphinx-3.0.1 lib/thinking_sphinx/search/merger.rb
thinking-sphinx-3.0.0 lib/thinking_sphinx/search/merger.rb
thinking-sphinx-3.0.0.rc lib/thinking_sphinx/search/merger.rb