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:



2
3
4
5
6
# File 'lib/thinking_sphinx/search/batch_inquirer.rb', line 2

def initialize(&block)
  @queries = []

  yield self if block_given?
end

Instance Method Details

#append_query(query) ⇒ Object



8
9
10
# File 'lib/thinking_sphinx/search/batch_inquirer.rb', line 8

def append_query(query)
  @queries << query
end

#resultsObject



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

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

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