Fix OLC search
This commit is contained in:
parent
1997408377
commit
32b80eeb3b
2 changed files with 5 additions and 1 deletions
|
@ -11,6 +11,7 @@ import net.osmand.data.LatLon;
|
|||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.osm.AbstractPoiType;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.LocationParser;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -782,7 +783,7 @@ public class SearchPhrase {
|
|||
searchWords.add(0, getUnknownSearchWord());
|
||||
Collections.sort(searchWords, commonWordsComparator);
|
||||
for (String s : searchWords) {
|
||||
if (s.length() > 0 && !Character.isDigit(s.charAt(0))) {
|
||||
if (s.length() > 0 && !Character.isDigit(s.charAt(0)) && !LocationParser.isValidOLC(s)) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,6 +82,9 @@ public class LocationParser {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean isValidOLC(String code) {
|
||||
return OpenLocationCode.isValidCode(code);
|
||||
}
|
||||
public static ParsedOpenLocationCode parseOpenLocationCode(String locPhrase) {
|
||||
ParsedOpenLocationCode parsedCode = new ParsedOpenLocationCode(locPhrase.trim());
|
||||
return !parsedCode.isValidCode() ? null : parsedCode;
|
||||
|
|
Loading…
Reference in a new issue