class ThinkingSphinx::Middlewares::Geographer::Inner

Attributes

context[R]

Public Class Methods

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

Public Instance Methods

call() click to toggle source
# File lib/thinking_sphinx/middlewares/geographer.rb, line 21
def call
  return unless geo

  context[:sphinxql].prepend_values geodist_clause
  context[:panes] << ThinkingSphinx::Panes::DistancePane
end

Private Instance Methods

fixed_format(float) click to toggle source
# File lib/thinking_sphinx/middlewares/geographer.rb, line 34
def fixed_format(float)
  ThinkingSphinx::FloatFormatter.new(float).fixed
end
geodist_clause() click to toggle source
# File lib/thinking_sphinx/middlewares/geographer.rb, line 42
def geodist_clause
  "GEODIST(#{fixed_format geo.first}, #{fixed_format geo.last}, #{latitude}, #{longitude}) AS geodist"
end
geolocation_attributes() click to toggle source
# File lib/thinking_sphinx/middlewares/geographer.rb, line 38
def geolocation_attributes
  @geolocation_attributes ||= GeolocationAttributes.new(context)
end