From a287d24f127d53de6a049efd798349dc409053ea Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 5 Sep 2007 17:20:09 +0000 Subject: [PATCH 1/1] Use BETWEEN for the node selection in the map API call as MySQL seems to process it more efficiently. --- app/controllers/api_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 7e8017f4e..407f6872a 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -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 } -- 2.43.2