From c65e91561f2267705d151249fcb1c9dd9f663ba0 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Tue, 22 Sep 2020 19:53:19 +0300 Subject: [PATCH] Fix initial search radius for nearest POIs --- .../java/net/osmand/search/core/SearchCoreFactory.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java index 360fafbdf9..e5c791a780 100644 --- a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java +++ b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java @@ -923,6 +923,7 @@ public class SearchCoreFactory { public static class SearchAmenityByTypeAPI extends SearchBaseAPI { private static final int BBOX_RADIUS = 10000; + private static final int BBOX_RADIUS_NEAREST = 1000; private SearchAmenityTypesAPI searchAmenityTypesAPI; private MapPoiTypes types; private AbstractPoiType unselectedPoiType; @@ -1007,7 +1008,14 @@ public class SearchCoreFactory { } this.nameFilter = nameFilter; if (poiTypeFilter != null) { - QuadRect bbox = phrase.getRadiusBBoxToSearch(BBOX_RADIUS); + int radius = BBOX_RADIUS; + if (phrase.getRadiusLevel() == 1 && poiTypeFilter instanceof CustomSearchPoiFilter) { + String name = ((CustomSearchPoiFilter) poiTypeFilter).getFilterId(); + if ("std_null".equals(name)) { + radius = BBOX_RADIUS_NEAREST; + } + } + QuadRect bbox = phrase.getRadiusBBoxToSearch(radius); List offlineIndexes = phrase.getOfflineIndexes(); Set searchedPois = new TreeSet<>(); for (BinaryMapIndexReader r : offlineIndexes) {