# File lib/thinking_sphinx/middlewares/geographer.rb, line 17 def initialize(context) @context = context end
# File lib/thinking_sphinx/middlewares/geographer.rb, line 21 def call return unless geo context[:sphinxql].values geodist_clause context[:panes] << ThinkingSphinx::Panes::DistancePane end
# File lib/thinking_sphinx/middlewares/geographer.rb, line 34 def fixed_format(float) ThinkingSphinx::FloatFormatter.new(float).fixed end
# 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
# File lib/thinking_sphinx/middlewares/geographer.rb, line 38 def geolocation_attributes @geolocation_attributes ||= GeolocationAttributes.new(context) end