Sha256: ca28f2550ae60819fc9101a974bb21b23b4fdae110d132e945694d21e4c70850

Contents?: true

Size: 712 Bytes

Versions: 6

Compression:

Stored size: 712 Bytes

Contents

module ThinkingSphinx
  class BundledSearch
    def initialize
      @searches = []
    end

    def search(*args)
      @searches << ThinkingSphinx.search(*args)
    end

    def search_for_ids(*args)
      @searches << ThinkingSphinx.search_for_ids(*args)
    end

    def searches
      populate
      @searches
    end

    private

    def populated?
      @populated
    end

    def populate
      return if populated?

      @populated = true

      ThinkingSphinx::Connection.take do |client|
        @searches.each { |search| search.append_to client }

        client.run.each_with_index do |results, index|
          searches[index].populate_from_queue results
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
friendlyfashion-thinking-sphinx-2.0.14.4 lib/thinking_sphinx/bundled_search.rb
friendlyfashion-thinking-sphinx-2.0.14.3 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-2.1.0 lib/thinking_sphinx/bundled_search.rb
thinking-sphinx-1.5.0 lib/thinking_sphinx/bundled_search.rb
friendlyfashion-thinking-sphinx-2.0.14.2 lib/thinking_sphinx/bundled_search.rb
friendlyfashion-thinking-sphinx-2.0.14.1 lib/thinking_sphinx/bundled_search.rb