Fix search priorities

This commit is contained in:
Alexey Kulish 2016-11-12 17:17:39 +03:00
parent dc3f3db408
commit 2c8d7d0f74
2 changed files with 24 additions and 23 deletions

View file

@ -52,30 +52,30 @@ public class SearchCoreFactory {
public static final int MAX_DEFAULT_SEARCH_RADIUS = 7;
//////////////// CONSTANTS //////////
public static final int SEARCH_REGION_API_PRIORITY = 3;
public static final int SEARCH_REGION_OBJECT_PRIORITY = 10;
public static final int SEARCH_REGION_API_PRIORITY = 300;
public static final int SEARCH_REGION_OBJECT_PRIORITY = 1000;
// context less
public static final int SEARCH_LOCATION_PRIORITY = 0;
public static final int SEARCH_AMENITY_TYPE_PRIORITY = 1;
public static final int SEARCH_AMENITY_TYPE_API_PRIORITY = 1;
public static final int SEARCH_AMENITY_TYPE_PRIORITY = 100;
public static final int SEARCH_AMENITY_TYPE_API_PRIORITY = 100;
// context
public static final int SEARCH_STREET_BY_CITY_PRIORITY = 2;
public static final int SEARCH_BUILDING_BY_CITY_PRIORITY = 3;
public static final int SEARCH_BUILDING_BY_STREET_PRIORITY = 1;
public static final int SEARCH_AMENITY_BY_TYPE_PRIORITY = 3;
public static final int SEARCH_STREET_BY_CITY_PRIORITY = 200;
public static final int SEARCH_BUILDING_BY_CITY_PRIORITY = 300;
public static final int SEARCH_BUILDING_BY_STREET_PRIORITY = 100;
public static final int SEARCH_AMENITY_BY_TYPE_PRIORITY = 300;
// context less (slow)
public static final int SEARCH_ADDRESS_BY_NAME_API_PRIORITY = 5;
public static final int SEARCH_ADDRESS_BY_NAME_API_PRIORITY_RADIUS2 = 5;
public static final int SEARCH_ADDRESS_BY_NAME_PRIORITY = 5;
public static final int SEARCH_ADDRESS_BY_NAME_PRIORITY_RADIUS2 = 5;
public static final int SEARCH_ADDRESS_BY_NAME_API_PRIORITY = 500;
public static final int SEARCH_ADDRESS_BY_NAME_API_PRIORITY_RADIUS2 = 500;
public static final int SEARCH_ADDRESS_BY_NAME_PRIORITY = 500;
public static final int SEARCH_ADDRESS_BY_NAME_PRIORITY_RADIUS2 = 500;
// context less (slower)
public static final int SEARCH_AMENITY_BY_NAME_PRIORITY = 7;
public static final int SEARCH_AMENITY_BY_NAME_API_PRIORITY_IF_POI_TYPE = 7;
public static final int SEARCH_AMENITY_BY_NAME_API_PRIORITY_IF_3_CHAR = 7;
public static final int SEARCH_AMENITY_BY_NAME_PRIORITY = 700;
public static final int SEARCH_AMENITY_BY_NAME_API_PRIORITY_IF_POI_TYPE = 700;
public static final int SEARCH_AMENITY_BY_NAME_API_PRIORITY_IF_3_CHAR = 700;
protected static final double SEARCH_AMENITY_BY_NAME_CITY_PRIORITY_DISTANCE = 0.001;
protected static final double SEARCH_AMENITY_BY_NAME_TOWN_PRIORITY_DISTANCE = 0.005;

View file

@ -22,13 +22,14 @@ import net.osmand.search.core.SearchResult;
public class QuickSearchHelper implements ResourceListener {
public static final int SEARCH_FAVORITE_API_PRIORITY = 1;
public static final int SEARCH_FAVORITE_API_CATEGORY_PRIORITY = 1;
public static final int SEARCH_FAVORITE_OBJECT_PRIORITY = 0;
public static final int SEARCH_WPT_API_PRIORITY = 1;
public static final int SEARCH_WPT_OBJECT_PRIORITY = 0;
public static final int SEARCH_HISTORY_API_PRIORITY = 1;
public static final int SEARCH_HISTORY_OBJECT_PRIORITY = 0;
public static final int SEARCH_FAVORITE_API_PRIORITY = 50;
public static final int SEARCH_FAVORITE_API_CATEGORY_PRIORITY = 50;
public static final int SEARCH_FAVORITE_OBJECT_PRIORITY = 50;
public static final int SEARCH_FAVORITE_CATEGORY_PRIORITY = 51;
public static final int SEARCH_WPT_API_PRIORITY = 50;
public static final int SEARCH_WPT_OBJECT_PRIORITY = 52;
public static final int SEARCH_HISTORY_API_PRIORITY = 50;
public static final int SEARCH_HISTORY_OBJECT_PRIORITY = 53;
private OsmandApplication app;
private SearchUICore core;
private SearchResultCollection resultCollection;
@ -113,7 +114,7 @@ public class QuickSearchHelper implements ResourceListener {
SearchResult sr = new SearchResult(phrase);
sr.localeName = point.getName();
sr.object = point;
sr.priority = SEARCH_FAVORITE_OBJECT_PRIORITY;
sr.priority = SEARCH_FAVORITE_CATEGORY_PRIORITY;
sr.objectType = ObjectType.FAVORITE;
sr.location = new LatLon(point.getLatitude(), point.getLongitude());
sr.preferredZoom = 17;