Use boundaries for SearchByName to speed up search

This commit is contained in:
sonora 2016-06-11 08:54:24 +02:00
parent 8cb46e19fc
commit 7aeef49f6f
2 changed files with 10 additions and 9 deletions

View file

@ -22,7 +22,7 @@ public class SearchByNameFilter extends PoiUIFilter {
super(application); super(application);
this.name = application.getString(R.string.poi_filter_by_name); this.name = application.getString(R.string.poi_filter_by_name);
this.filterId = FILTER_ID; this.filterId = FILTER_ID;
this.distanceToSearchValues = new double[] {100, 1000, 5000}; this.distanceToSearchValues = new double[] {100, 1000, 20000};
} }
@Override @Override

View file

@ -850,14 +850,15 @@ public class ResourceManager {
} }
} }
} }
// int left = MapUtils.get31TileNumberX(leftLongitude); int left = MapUtils.get31TileNumberX(leftLongitude);
// int top = MapUtils.get31TileNumberY(topLatitude); int top = MapUtils.get31TileNumberY(topLatitude);
// int right = MapUtils.get31TileNumberX(rightLongitude); int right = MapUtils.get31TileNumberX(rightLongitude);
// int bottom = MapUtils.get31TileNumberY(bottomLatitude); int bottom = MapUtils.get31TileNumberY(bottomLatitude);
int left = 0; // Not using boundares results in very slow initial search if user has many maps installed
int top = 0; // int left = 0;
int right = Integer.MAX_VALUE; // int top = 0;
int bottom = Integer.MAX_VALUE; // int right = Integer.MAX_VALUE;
// int bottom = Integer.MAX_VALUE;
for (AmenityIndexRepositoryBinary index : list) { for (AmenityIndexRepositoryBinary index : list) {
if (matcher != null && matcher.isCancelled()) { if (matcher != null && matcher.isCancelled()) {
break; break;