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.



6
7
8
# File 'lib/thinking_sphinx/batched_search.rb', line 6

def initialize
  @searches = []
end

Instance Attribute Details

#searchesObject

Returns the value of attribute searches.



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

def searches
  @searches
end

Instance Method Details

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



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

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

  middleware.call contexts
  searches.each &:populated!

  @populated = true
end