Search - introduce top visible types (2)

This commit is contained in:
crimean 2018-11-02 19:04:03 +03:00
parent b2ef894e67
commit 04a20a1d0d
2 changed files with 6 additions and 1 deletions

View file

@ -731,7 +731,8 @@ public class SearchUICore {
@Override @Override
public int compare(SearchResult o1, SearchResult o2) { public int compare(SearchResult o1, SearchResult o2) {
if (o1.getFoundWordCount() != o2.getFoundWordCount()) { if (!ObjectType.isTopVisible(o1.objectType) && !ObjectType.isTopVisible(o2.objectType)
&& o1.getFoundWordCount() != o2.getFoundWordCount()) {
return -Algorithms.compare(o1.getFoundWordCount(), o2.getFoundWordCount()); return -Algorithms.compare(o1.getFoundWordCount(), o2.getFoundWordCount());
} }
if (!sortByName) { if (!sortByName) {

View file

@ -34,6 +34,10 @@ public enum ObjectType {
return t == CITY || t == VILLAGE || t == POSTCODE || t == STREET || t == HOUSE || t == STREET_INTERSECTION; return t == CITY || t == VILLAGE || t == POSTCODE || t == STREET || t == HOUSE || t == STREET_INTERSECTION;
} }
public static boolean isTopVisible(ObjectType t) {
return t == POI_TYPE || t == FAVORITE || t == FAVORITE_GROUP || t == WPT || t == LOCATION || t == PARTIAL_LOCATION;
}
public static ObjectType getExclusiveSearchType(ObjectType t) { public static ObjectType getExclusiveSearchType(ObjectType t) {
if (t == FAVORITE_GROUP) { if (t == FAVORITE_GROUP) {
return FAVORITE; return FAVORITE;