Skip to content
Snippets Groups Projects
Commit 4a241573 authored by Alex Reisner's avatar Alex Reisner
Browse files

Restore bounding box conditions.

This fixes SQLite near methods and speeds up MySQL and Postgres.
parent 413e6a9c
No related branches found
No related tags found
No related merge requests found
......@@ -110,12 +110,16 @@ module Geocoder
conditions = \
["#{lat_attr} BETWEEN ? AND ? AND #{lon_attr} BETWEEN ? AND ?"] +
coordinate_bounds(latitude, longitude, radius)
if obj = options[:exclude]
conditions[0] << " AND id != ?"
conditions << obj.id
end
{
:group => columns.map{ |c| c.name}.join(','),
:order => options[:order],
:limit => options[:limit],
:offset => options[:offset],
:conditions => (obj = options[:exclude]) ? ["id != ?", obj.id] : nil
:conditions => conditions
}
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment