Merge pull request #9646 from androiddevkotlin/street_complete_parsing
Fix #9532
This commit is contained in:
commit
133e8a25ef
4 changed files with 54 additions and 54 deletions
|
@ -145,7 +145,7 @@ public class SearchCoreFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void subSearchApiOrPublish(SearchPhrase phrase, SearchResultMatcher resultMatcher, SearchResult res, SearchBaseAPI api,
|
protected void subSearchApiOrPublish(SearchPhrase phrase, SearchResultMatcher resultMatcher, SearchResult res, SearchBaseAPI api,
|
||||||
boolean publish)
|
boolean publish)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
phrase.countUnknownWordsMatchMainResult(res);
|
phrase.countUnknownWordsMatchMainResult(res);
|
||||||
boolean firstUnknownWordMatches = res.firstUnknownWordMatches;
|
boolean firstUnknownWordMatches = res.firstUnknownWordMatches;
|
||||||
|
@ -206,9 +206,9 @@ public class SearchCoreFactory {
|
||||||
if (!leftUnknownSearchWords.isEmpty() && api != null && api.isSearchAvailable(phrase)) {
|
if (!leftUnknownSearchWords.isEmpty() && api != null && api.isSearchAvailable(phrase)) {
|
||||||
SearchPhrase nphrase = phrase.selectWord(res, leftUnknownSearchWords,
|
SearchPhrase nphrase = phrase.selectWord(res, leftUnknownSearchWords,
|
||||||
phrase.isLastUnknownSearchWordComplete() ||
|
phrase.isLastUnknownSearchWordComplete() ||
|
||||||
!leftUnknownSearchWords.contains(phrase.getLastUnknownSearchWord()));
|
!leftUnknownSearchWords.contains(phrase.getLastUnknownSearchWord()));
|
||||||
SearchResult prev = resultMatcher.setParentSearchResult(publish ? res :
|
SearchResult prev = resultMatcher.setParentSearchResult(publish ? res :
|
||||||
resultMatcher.getParentSearchResult());
|
resultMatcher.getParentSearchResult());
|
||||||
api.search(nphrase, resultMatcher);
|
api.search(nphrase, resultMatcher);
|
||||||
resultMatcher.setParentSearchResult(prev);
|
resultMatcher.setParentSearchResult(prev);
|
||||||
}
|
}
|
||||||
|
@ -764,7 +764,7 @@ public class SearchCoreFactory {
|
||||||
} else {
|
} else {
|
||||||
String enTranslation = a.getEnTranslation().toLowerCase();
|
String enTranslation = a.getEnTranslation().toLowerCase();
|
||||||
if (!"no".equals(enTranslation) // && !"yes".equals(enTranslation)
|
if (!"no".equals(enTranslation) // && !"yes".equals(enTranslation)
|
||||||
) {
|
) {
|
||||||
PoiTypeResult ptr = checkPoiType(nm, a);
|
PoiTypeResult ptr = checkPoiType(nm, a);
|
||||||
if (ptr != null) {
|
if (ptr != null) {
|
||||||
results.put(a.getKeyName(), ptr);
|
results.put(a.getKeyName(), ptr);
|
||||||
|
@ -869,7 +869,7 @@ public class SearchCoreFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPoiTypeResult(SearchPhrase phrase, SearchResultMatcher resultMatcher, boolean showTopFiltersOnly,
|
private void addPoiTypeResult(SearchPhrase phrase, SearchResultMatcher resultMatcher, boolean showTopFiltersOnly,
|
||||||
String stdFilterId, SearchResult res) {
|
String stdFilterId, SearchResult res) {
|
||||||
res.priorityDistance = 0;
|
res.priorityDistance = 0;
|
||||||
res.objectType = ObjectType.POI_TYPE;
|
res.objectType = ObjectType.POI_TYPE;
|
||||||
res.firstUnknownWordMatches = true;
|
res.firstUnknownWordMatches = true;
|
||||||
|
|
|
@ -181,7 +181,7 @@ public class GeoPointParserUtil {
|
||||||
}
|
}
|
||||||
} else if (host.startsWith("map.baidu.")) { // .com and .cn both work
|
} else if (host.startsWith("map.baidu.")) { // .com and .cn both work
|
||||||
/* Baidu Map uses a custom format for lat/lon., it is basically standard lat/lon
|
/* Baidu Map uses a custom format for lat/lon., it is basically standard lat/lon
|
||||||
* multiplied by 100,000, then rounded to an integer */
|
* multiplied by 100,000, then rounded to an integer */
|
||||||
String zm = params.get("l");
|
String zm = params.get("l");
|
||||||
String[] vls = silentSplit(params.get("c"), ",");
|
String[] vls = silentSplit(params.get("c"), ",");
|
||||||
if (vls != null && vls.length >= 2) {
|
if (vls != null && vls.length >= 2) {
|
||||||
|
@ -297,7 +297,7 @@ public class GeoPointParserUtil {
|
||||||
Pattern p;
|
Pattern p;
|
||||||
Matcher matcher;
|
Matcher matcher;
|
||||||
final String[] patterns = {
|
final String[] patterns = {
|
||||||
/* though this looks like Query String, it is also used as part of the Fragment */
|
/* though this looks like Query String, it is also used as part of the Fragment */
|
||||||
".*q=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?).*&radius=(\\d+).*",
|
".*q=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?).*&radius=(\\d+).*",
|
||||||
".*q=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?).*",
|
".*q=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?).*",
|
||||||
".*p=(?:[A-Z0-9]+),([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?).*",};
|
".*p=(?:[A-Z0-9]+),([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?).*",};
|
||||||
|
@ -492,7 +492,7 @@ public class GeoPointParserUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("z".equals(paramName) && paramValue != null) {
|
if ("z".equals(paramName) && paramValue != null) {
|
||||||
zoom = Integer.parseInt(paramValue);
|
zoom = (int) Float.parseFloat(paramValue);
|
||||||
} else if ("q".equals(paramName) && paramValue != null) {
|
} else if ("q".equals(paramName) && paramValue != null) {
|
||||||
searchRequest = URLDecoder.decode(paramValue);
|
searchRequest = URLDecoder.decode(paramValue);
|
||||||
}
|
}
|
||||||
|
@ -587,7 +587,7 @@ public class GeoPointParserUtil {
|
||||||
private static int parseZoom(String zoom) {
|
private static int parseZoom(String zoom) {
|
||||||
try {
|
try {
|
||||||
if (zoom != null) {
|
if (zoom != null) {
|
||||||
return Integer.valueOf(zoom);
|
return (int) Float.parseFloat(zoom);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
}
|
}
|
||||||
|
@ -774,7 +774,7 @@ public class GeoPointParserUtil {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return isGeoPoint() ?
|
return isGeoPoint() ?
|
||||||
String.format("GeoParsedPoint [lat=%.5f, lon=%.5f, zoom=%d, label=%s]", lat, lon, zoom, label) :
|
String.format("GeoParsedPoint [lat=%.5f, lon=%.5f, zoom=%d, label=%s]", lat, lon, zoom, label) :
|
||||||
String.format("GeoParsedPoint [query=%s]",query);
|
String.format("GeoParsedPoint [query=%s]",query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -716,7 +716,7 @@ public class GeoPointParserUtilTest {
|
||||||
actual = GeoPointParserUtil.parse(url);
|
actual = GeoPointParserUtil.parse(url);
|
||||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||||
|
|
||||||
/* URLs straight from various services, instead of generated here */
|
/* URLs straight from various services, instead of generated here */
|
||||||
|
|
||||||
String urls[] = {
|
String urls[] = {
|
||||||
"https://openstreetmap.org/go/0LQ127-?m",
|
"https://openstreetmap.org/go/0LQ127-?m",
|
||||||
|
|
Loading…
Reference in a new issue