Use BETWEEN for the node selection in the map API call as MySQL seems to
process it more efficiently.
This commit is contained in:
parent
37317b8295
commit
a287d24f12
1 changed files with 1 additions and 1 deletions
|
@ -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 }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue