Fix tests

This commit is contained in:
Victor Shcherb 2020-06-17 19:56:30 +02:00
parent 820dbaec0e
commit e0b3e82cb3
2 changed files with 13 additions and 2 deletions

View file

@ -203,7 +203,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, phrase.isLastUnknownSearchWordComplete()); SearchPhrase nphrase = phrase.selectWord(res, leftUnknownSearchWords,
phrase.isLastUnknownSearchWordComplete() ||
!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);

View file

@ -526,7 +526,7 @@ public class SearchPhrase {
public NameStringMatcher getFirstUnknownNameStringMatcher() { public NameStringMatcher getFirstUnknownNameStringMatcher() {
if (firstUnknownNameStringMatcher == null) { if (firstUnknownNameStringMatcher == null) {
firstUnknownNameStringMatcher = getNameStringMatcher(firstUnknownSearchWord, lastUnknownSearchWordComplete); firstUnknownNameStringMatcher = getNameStringMatcher(firstUnknownSearchWord, isFirstUnknownSearchWordComplete());
} }
return firstUnknownNameStringMatcher; return firstUnknownNameStringMatcher;
} }
@ -792,6 +792,13 @@ public class SearchPhrase {
} }
return r; return r;
} }
public String getLastUnknownSearchWord() {
if(otherUnknownWords.size() > 0) {
return otherUnknownWords.get(otherUnknownWords.size() - 1);
}
return firstUnknownSearchWord;
}
public int getRadiusSearch(int meters, int radiusLevel) { public int getRadiusSearch(int meters, int radiusLevel) {
@ -877,4 +884,6 @@ public class SearchPhrase {
} }