Class: ThinkingSphinx::Search::BatchInquirer

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/search/batch_inquirer.rb

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ BatchInquirer

Returns a new instance of BatchInquirer.

Yields:

  • (_self)

Yield Parameters:



4
5
6
7
8
# File 'lib/thinking_sphinx/search/batch_inquirer.rb', line 4

def initialize(&block)
  @queries = []

  yield self if block_given?
end

Instance Method Details

#append_query(query) ⇒ Object



10
11
12
# File 'lib/thinking_sphinx/search/batch_inquirer.rb', line 10

def append_query(query)
  @queries << query
end

#resultsObject



14
15
16
17
18
19
20
21
22
# File 'lib/thinking_sphinx/search/batch_inquirer.rb', line 14

def results
  @results ||= begin
    @queries.freeze

    ThinkingSphinx::Connection.take do |connection|
      connection.query_all *@queries
    end
  end
end