Add fuel test
This commit is contained in:
parent
1c15cd5797
commit
ca69159332
3 changed files with 42 additions and 0 deletions
|
@ -9,6 +9,7 @@ import net.osmand.data.City;
|
|||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.MapObject;
|
||||
import net.osmand.data.Street;
|
||||
import net.osmand.osm.AbstractPoiType;
|
||||
import net.osmand.osm.MapPoiTypes;
|
||||
import net.osmand.search.core.CustomSearchPoiFilter;
|
||||
import net.osmand.search.core.ObjectType;
|
||||
|
@ -858,6 +859,7 @@ public class SearchUICore {
|
|||
TOP_VISIBLE,
|
||||
FOUND_WORD_COUNT, // more is better (top)
|
||||
UNKNOWN_PHRASE_MATCH_WEIGHT, // more is better (top)
|
||||
COMPARE_AMENITY_TYPE_ADDITIONAL,
|
||||
SEARCH_DISTANCE_IF_NOT_BY_NAME,
|
||||
COMPARE_FIRST_NUMBER_IN_NAME,
|
||||
COMPARE_DISTANCE_TO_PARENT_SEARCH_RESULT, // makes sense only for inner subqueries
|
||||
|
@ -908,6 +910,17 @@ public class SearchUICore {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case COMPARE_AMENITY_TYPE_ADDITIONAL: {
|
||||
if(o1.object instanceof AbstractPoiType && o2.object instanceof AbstractPoiType ) {
|
||||
boolean additional1 = ((AbstractPoiType) o1.object).isAdditional();
|
||||
boolean additional2 = ((AbstractPoiType) o2.object).isAdditional();
|
||||
if (additional1 != additional2) {
|
||||
// -1 - means 1st is less than 2nd
|
||||
return additional1 ? 1 : -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case COMPARE_DISTANCE_TO_PARENT_SEARCH_RESULT:
|
||||
double ps1 = o1.parentSearchResult == null ? 0 : o1.parentSearchResult.getSearchDistance(c.loc);
|
||||
double ps2 = o2.parentSearchResult == null ? 0 : o2.parentSearchResult.getSearchDistance(c.loc);
|
||||
|
|
|
@ -702,6 +702,9 @@ public class SearchCoreFactory {
|
|||
if (nm.matches(pf.getEnTranslation())) {
|
||||
lst = addToList(pf.getEnTranslation(), lst);
|
||||
}
|
||||
if (nm.matches(pf.getKeyName())) {
|
||||
lst = addToList(pf.getKeyName().replace('_', ' '), lst);
|
||||
}
|
||||
|
||||
if (nm.matches(pf.getSynonyms())) {
|
||||
String[] synonyms = pf.getSynonyms().split(";");
|
||||
|
@ -784,6 +787,7 @@ public class SearchCoreFactory {
|
|||
String stdFilterId , SearchResult res) {
|
||||
res.priorityDistance = 0;
|
||||
res.objectType = ObjectType.POI_TYPE;
|
||||
res.firstUnknownWordMatches = true;
|
||||
if (showTopFiltersOnly) {
|
||||
if (activePoiFilters.containsKey(stdFilterId)) {
|
||||
res.priority = getPoiTypePriority(stdFilterId);
|
||||
|
|
25
OsmAnd-java/src/test/resources/search/poi_fuel.json
Normal file
25
OsmAnd-java/src/test/resources/search/poi_fuel.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"settings": {
|
||||
"lat": "51.04933",
|
||||
"lon": "13.73815",
|
||||
"radiusLevel": 1,
|
||||
"totalLimit": -1,
|
||||
"lang": "",
|
||||
"transliterateIfMissing": false,
|
||||
"emptyQueryAllowed": false,
|
||||
"sortByName": false
|
||||
},
|
||||
"phrase": ["Fuel", "Fuel "],
|
||||
"results": [[
|
||||
"Aircraft fuel station (Filling station) [[1, POI_TYPE, 1.000, 0.00 km]]",
|
||||
"Gas station (Filling station) [[1, POI_TYPE, 1.000, 0.00 km]]",
|
||||
"Gas station for boats (Filling station) [[1, POI_TYPE, 1.000, 0.00 km]]"
|
||||
],
|
||||
[
|
||||
"Aircraft fuel station (Filling station) [[1, POI_TYPE, 1.000, 0.00 km]]",
|
||||
"Gas station (Filling station) [[1, POI_TYPE, 1.000, 0.00 km]]",
|
||||
"Gas station for boats (Filling station) [[1, POI_TYPE, 1.000, 0.00 km]]"
|
||||
]],
|
||||
"amenities": [],
|
||||
"cities": []
|
||||
}
|
Loading…
Reference in a new issue