Class: ThinkingSphinx::Middlewares::Inquirer

Inherits:
Middleware
  • Object
show all
Defined in:
lib/thinking_sphinx/middlewares/inquirer.rb

Defined Under Namespace

Classes: Inner

Instance Method Summary collapse

Methods inherited from Middleware

#initialize

Constructor Details

This class inherits a constructor from ThinkingSphinx::Middlewares::Middleware

Instance Method Details

#call(contexts) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/thinking_sphinx/middlewares/inquirer.rb', line 6

def call(contexts)
  @contexts = contexts
  @batch    = nil

  ThinkingSphinx::Logger.log :query, combined_queries do
    batch.results
  end

  index = 0
  contexts.each do |context|
    Inner.new(context).call batch.results[index], batch.results[index + 1]

    index += 2
  end

  app.call contexts
end