class ThinkingSphinx::Middlewares::Inquirer::Inner

Attributes

context[R]

Public Class Methods

new(context) click to toggle source
# File lib/thinking_sphinx/middlewares/inquirer.rb, line 42
def initialize(context)
  @context = context
end

Public Instance Methods

call(raw_results, meta_results) click to toggle source
# File lib/thinking_sphinx/middlewares/inquirer.rb, line 46
def call(raw_results, meta_results)
  context[:results] = raw_results.to_a
  context[:raw]     = context[:results].dup
  context[:meta]    = meta_results.inject({}) { |hash, row|
    hash[row['Variable_name']] = row['Value']
    hash
  }

  total = context[:meta]['total_found']
  ThinkingSphinx::Logger.log :message, "Found #{total} result#{'s' unless total == 1}"
end