Sha256: e096973978963d492441e833da936570d87d6ffe664529a2890405237c1ff474

Contents?: true

Size: 818 Bytes

Versions: 29

Compression:

Stored size: 818 Bytes

Contents

module ThinkingSphinx
  class BundledSearch
    attr_reader :client
    
    def initialize
      @searches = []
    end
    
    def search(*args)
      @searches << ThinkingSphinx.search(*args)
      @searches.last.append_to client
    end
    
    def search_for_ids(*args)
      @searches << ThinkingSphinx.search_for_ids(*args)
      @searches.last.append_to client
    end
    
    def searches
      populate
      @searches
    end
    
    private
    
    def client
      @client ||= ThinkingSphinx::Configuration.instance.client
    end
    
    def populated?
      @populated
    end
    
    def populate
      return if populated?
      
      @populated = true
      
      client.run.each_with_index do |results, index|
        searches[index].populate_from_queue results
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 3 rubygems

Version Path
thinking-sphinx-2.0.12 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-1.4.12 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-2.0.11 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-1.4.11 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-2.0.10 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-1.4.10 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-2.0.9 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-1.4.9 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-2.0.8 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-1.4.8 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-2.0.7 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-1.4.7 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-2.0.5 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-1.4.6 lib/thinking_sphinx/bundled_search.rb
sayso-thinking-sphinx-2.0.3.002 lib/thinking_sphinx/bundled_search.rb
sayso-thinking-sphinx-2.0.3.001 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-2.0.4 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-1.4.5 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-2.0.3 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-1.4.4 lib/thinking_sphinx/bundled_search.rb