Class: ThinkingSphinx::BatchedSearch

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBatchedSearch

Returns a new instance of BatchedSearch



4
5
6
# File 'lib/thinking_sphinx/batched_search.rb', line 4

def initialize
  @searches = []
end

Instance Attribute Details

#searchesObject

Returns the value of attribute searches



2
3
4
# File 'lib/thinking_sphinx/batched_search.rb', line 2

def searches
  @searches
end

Instance Method Details

#populate(middleware = ThinkingSphinx::Middlewares::DEFAULT) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/thinking_sphinx/batched_search.rb', line 8

def populate(middleware = ThinkingSphinx::Middlewares::DEFAULT)
  return if populated? || searches.empty?

  middleware.call contexts
  searches.each &:populated!

  @populated = true
end