Disable unnecessary online search

This commit is contained in:
Alexander Sytnyk 2017-10-26 13:33:08 +03:00
parent 0cb24ed0db
commit cf2376cf12

View file

@ -50,6 +50,7 @@ public class QuickSearchHelper implements ResourceListener {
public static final int SEARCH_HISTORY_OBJECT_PRIORITY = 53; public static final int SEARCH_HISTORY_OBJECT_PRIORITY = 53;
public static final int SEARCH_ONLINE_AMENITY_PRIORITY = 700; public static final int SEARCH_ONLINE_AMENITY_PRIORITY = 700;
public static final int SEARCH_ONLINE_ADDRESS_PRIORITY = 500; public static final int SEARCH_ONLINE_ADDRESS_PRIORITY = 500;
public static final int SEARCH_ONLINE_API_PRIORITY = 500;
private OsmandApplication app; private OsmandApplication app;
private SearchUICore core; private SearchUICore core;
private SearchResultCollection resultCollection; private SearchResultCollection resultCollection;
@ -323,7 +324,7 @@ public class QuickSearchHelper implements ResourceListener {
public static class SearchOnlineApi extends SearchBaseAPI { public static class SearchOnlineApi extends SearchBaseAPI {
OsmandApplication app; private OsmandApplication app;
private NominatimPoiFilter poiFilter; private NominatimPoiFilter poiFilter;
private NominatimPoiFilter addressFilter; private NominatimPoiFilter addressFilter;
@ -346,6 +347,15 @@ public class QuickSearchHelper implements ResourceListener {
return true; return true;
} }
@Override
public int getSearchPriority(SearchPhrase p) {
ObjectType[] types = p.getSearchTypes();
if (types != null && types.length == 1 && types[0] == ObjectType.ONLINE_SEARCH) {
return SEARCH_ONLINE_API_PRIORITY;
}
return -1;
}
private void publishAmenities(SearchPhrase phrase, SearchResultMatcher matcher, List<Amenity> amenities, boolean poi) { private void publishAmenities(SearchPhrase phrase, SearchResultMatcher matcher, List<Amenity> amenities, boolean poi) {
for (Amenity amenity : amenities) { for (Amenity amenity : amenities) {
SearchResult sr = getSearchResult(phrase, poi, amenity); SearchResult sr = getSearchResult(phrase, poi, amenity);