Class: ThinkingSphinx::Middlewares::Inquirer::Inner

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

Instance Method Summary (collapse)

Constructor Details

- (Inner) initialize(context)



42
43
44
# File 'lib/thinking_sphinx/middlewares/inquirer.rb', line 42

def initialize(context)
  @context = context
end

Instance Method Details

- (Object) call(raw_results, meta_results)



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/thinking_sphinx/middlewares/inquirer.rb', line 46

def call(raw_results, meta_results)
  context[:results] = raw_results
  context[:raw]     = raw_results
  context[:meta]    = meta_results.inject({}) { |hash, row|
    hash[row['Variable_name']] = row['Value']
    hash
  }

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