diff --git a/OsmAnd-java/src/main/java/net/osmand/CollatorStringMatcher.java b/OsmAnd-java/src/main/java/net/osmand/CollatorStringMatcher.java index f5808961d7..8048595615 100644 --- a/OsmAnd-java/src/main/java/net/osmand/CollatorStringMatcher.java +++ b/OsmAnd-java/src/main/java/net/osmand/CollatorStringMatcher.java @@ -33,7 +33,16 @@ public class CollatorStringMatcher implements StringMatcher { public CollatorStringMatcher(String part, StringMatcherMode mode) { this.collator = OsmAndCollator.primaryCollator(); - this.part = simplifyStringAndAlignChars(part); + part = simplifyStringAndAlignChars(part); + if (part.length() > 0 && part.charAt(part.length() - 1) == '.') { + part = part.substring(0, part.length() - 1); + if (mode == StringMatcherMode.CHECK_EQUALS_FROM_SPACE) { + mode = StringMatcherMode.CHECK_STARTS_FROM_SPACE; + } else if (mode == StringMatcherMode.CHECK_EQUALS) { + mode = StringMatcherMode.CHECK_ONLY_STARTS_WITH; + } + } + this.part = part; this.mode = mode; } diff --git a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchPhrase.java b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchPhrase.java index 7306d2e48d..4cc5e63a84 100644 --- a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchPhrase.java +++ b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchPhrase.java @@ -281,6 +281,11 @@ public class SearchPhrase { for (String s : searchWords) { if (s.length() > 0 && !Character.isDigit(s.charAt(0)) && !LocationParser.isValidOLC(s)) { mainUnknownWordToSearch = s.trim(); + if (mainUnknownWordToSearch.endsWith(".")) { + mainUnknownWordToSearch = mainUnknownWordToSearch.substring(0, + mainUnknownWordToSearch.length() - 1); + mainUnknownSearchWordComplete = false; + } int unknownInd = unknownSearchWords.indexOf(s); if (!lastUnknownSearchWordComplete && unknownSearchWords.size() - 1 == unknownInd) { mainUnknownSearchWordComplete = false;