Class: ThinkingSphinx::Search::BatchInquirer

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

Instance Method Summary (collapse)

Constructor Details

- (BatchInquirer) initialize {|_self| ... }

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

- (Object) append_query(query)



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

def append_query(query)
  @queries << query
end

- (Object) results



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