From 7aeef49f6f1a9954dc4115e27bdaa780ffa63e48 Mon Sep 17 00:00:00 2001 From: sonora Date: Sat, 11 Jun 2016 08:54:24 +0200 Subject: [PATCH] Use boundaries for SearchByName to speed up search --- .../net/osmand/plus/poi/SearchByNameFilter.java | 2 +- .../osmand/plus/resources/ResourceManager.java | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/poi/SearchByNameFilter.java b/OsmAnd/src/net/osmand/plus/poi/SearchByNameFilter.java index 5d103313ae..ca85a10744 100644 --- a/OsmAnd/src/net/osmand/plus/poi/SearchByNameFilter.java +++ b/OsmAnd/src/net/osmand/plus/poi/SearchByNameFilter.java @@ -22,7 +22,7 @@ public class SearchByNameFilter extends PoiUIFilter { super(application); this.name = application.getString(R.string.poi_filter_by_name); this.filterId = FILTER_ID; - this.distanceToSearchValues = new double[] {100, 1000, 5000}; + this.distanceToSearchValues = new double[] {100, 1000, 20000}; } @Override diff --git a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java index a13f41ceac..ae3be71bce 100644 --- a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java +++ b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java @@ -850,14 +850,15 @@ public class ResourceManager { } } } -// int left = MapUtils.get31TileNumberX(leftLongitude); -// int top = MapUtils.get31TileNumberY(topLatitude); -// int right = MapUtils.get31TileNumberX(rightLongitude); -// int bottom = MapUtils.get31TileNumberY(bottomLatitude); - int left = 0; - int top = 0; - int right = Integer.MAX_VALUE; - int bottom = Integer.MAX_VALUE; + int left = MapUtils.get31TileNumberX(leftLongitude); + int top = MapUtils.get31TileNumberY(topLatitude); + int right = MapUtils.get31TileNumberX(rightLongitude); + int bottom = MapUtils.get31TileNumberY(bottomLatitude); + // Not using boundares results in very slow initial search if user has many maps installed +// int left = 0; +// int top = 0; +// int right = Integer.MAX_VALUE; +// int bottom = Integer.MAX_VALUE; for (AmenityIndexRepositoryBinary index : list) { if (matcher != null && matcher.isCancelled()) { break;