Use BETWEEN for the node selection in the map API call as MySQL seems to

process it more efficiently.
This commit is contained in:
Tom Hughes 2007-09-05 17:20:09 +00:00
parent 37317b8295
commit a287d24f12

View file

@ -141,7 +141,7 @@ class ApiController < ApplicationController
end
# get all the nodes
nodes = Node.find(:all, :conditions => ['latitude > ? AND longitude > ? AND latitude < ? AND longitude < ? AND visible = 1', min_lat, min_lon, max_lat, max_lon])
nodes = Node.find(:all, :conditions => ['latitude BETWEEN ? AND ? AND longitude BETWEEN ? AND ? AND visible = 1', min_lat, max_lat, min_lon, max_lon])
node_ids = nodes.collect {|node| node.id }