This commit is contained in:
Victor Shcherb 2020-06-19 19:04:08 +02:00
parent 54c0510bbe
commit 8298dbdf17
2 changed files with 15 additions and 1 deletions

View file

@ -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;
}

View file

@ -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;