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,
|
||||
boolean publish)
|
||||
boolean publish)
|
||||
throws IOException {
|
||||
phrase.countUnknownWordsMatchMainResult(res);
|
||||
boolean firstUnknownWordMatches = res.firstUnknownWordMatches;
|
||||
|
@ -206,9 +206,9 @@ public class SearchCoreFactory {
|
|||
if (!leftUnknownSearchWords.isEmpty() && api != null && api.isSearchAvailable(phrase)) {
|
||||
SearchPhrase nphrase = phrase.selectWord(res, leftUnknownSearchWords,
|
||||
phrase.isLastUnknownSearchWordComplete() ||
|
||||
!leftUnknownSearchWords.contains(phrase.getLastUnknownSearchWord()));
|
||||
!leftUnknownSearchWords.contains(phrase.getLastUnknownSearchWord()));
|
||||
SearchResult prev = resultMatcher.setParentSearchResult(publish ? res :
|
||||
resultMatcher.getParentSearchResult());
|
||||
resultMatcher.getParentSearchResult());
|
||||
api.search(nphrase, resultMatcher);
|
||||
resultMatcher.setParentSearchResult(prev);
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ public class SearchCoreFactory {
|
|||
} else {
|
||||
String enTranslation = a.getEnTranslation().toLowerCase();
|
||||
if (!"no".equals(enTranslation) // && !"yes".equals(enTranslation)
|
||||
) {
|
||||
) {
|
||||
PoiTypeResult ptr = checkPoiType(nm, a);
|
||||
if (ptr != null) {
|
||||
results.put(a.getKeyName(), ptr);
|
||||
|
@ -869,7 +869,7 @@ public class SearchCoreFactory {
|
|||
}
|
||||
|
||||
private void addPoiTypeResult(SearchPhrase phrase, SearchResultMatcher resultMatcher, boolean showTopFiltersOnly,
|
||||
String stdFilterId, SearchResult res) {
|
||||
String stdFilterId, SearchResult res) {
|
||||
res.priorityDistance = 0;
|
||||
res.objectType = ObjectType.POI_TYPE;
|
||||
res.firstUnknownWordMatches = true;
|
||||
|
|
|
@ -181,7 +181,7 @@ public class GeoPointParserUtil {
|
|||
}
|
||||
} 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
|
||||
* multiplied by 100,000, then rounded to an integer */
|
||||
* multiplied by 100,000, then rounded to an integer */
|
||||
String zm = params.get("l");
|
||||
String[] vls = silentSplit(params.get("c"), ",");
|
||||
if (vls != null && vls.length >= 2) {
|
||||
|
@ -297,7 +297,7 @@ public class GeoPointParserUtil {
|
|||
Pattern p;
|
||||
Matcher matcher;
|
||||
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+)?).*",
|
||||
".*p=(?:[A-Z0-9]+),([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?).*",};
|
||||
|
@ -492,7 +492,7 @@ public class GeoPointParserUtil {
|
|||
}
|
||||
|
||||
if ("z".equals(paramName) && paramValue != null) {
|
||||
zoom = Integer.parseInt(paramValue);
|
||||
zoom = (int) Float.parseFloat(paramValue);
|
||||
} else if ("q".equals(paramName) && paramValue != null) {
|
||||
searchRequest = URLDecoder.decode(paramValue);
|
||||
}
|
||||
|
@ -587,7 +587,7 @@ public class GeoPointParserUtil {
|
|||
private static int parseZoom(String zoom) {
|
||||
try {
|
||||
if (zoom != null) {
|
||||
return Integer.valueOf(zoom);
|
||||
return (int) Float.parseFloat(zoom);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
|
@ -774,7 +774,7 @@ public class GeoPointParserUtil {
|
|||
public String toString() {
|
||||
return isGeoPoint() ?
|
||||
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);
|
||||
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[] = {
|
||||
"https://openstreetmap.org/go/0LQ127-?m",
|
||||
|
|
Loading…
Reference in a new issue