class ThinkingSphinx::Middlewares::Inquirer
Public Instance Methods
call(contexts)
click to toggle source
# File lib/thinking_sphinx/middlewares/inquirer.rb, line 4 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
Private Instance Methods
batch()
click to toggle source
# File lib/thinking_sphinx/middlewares/inquirer.rb, line 24 def batch @batch ||= begin batch = ThinkingSphinx::Search::BatchInquirer.new @contexts.each do |context| batch.append_query context[:sphinxql].to_sql batch.append_query Riddle::Query.meta end batch end end
combined_queries()
click to toggle source
# File lib/thinking_sphinx/middlewares/inquirer.rb, line 37 def combined_queries @contexts.collect { |context| context[:sphinxql].to_sql }.join('; ') end