From f58663be20018394ecac2dfe81bb48570b8c43f2 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 17 Apr 2017 20:07:56 +0300 Subject: [PATCH] Fix search core --- .../src/net/osmand/search/core/SearchCoreFactory.java | 5 ++--- OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/search/core/SearchCoreFactory.java b/OsmAnd-java/src/net/osmand/search/core/SearchCoreFactory.java index 7ca4cfcea8..a6e21fe416 100644 --- a/OsmAnd-java/src/net/osmand/search/core/SearchCoreFactory.java +++ b/OsmAnd-java/src/net/osmand/search/core/SearchCoreFactory.java @@ -308,6 +308,7 @@ public class SearchCoreFactory { if (phrase.isEmptyQueryAllowed() && phrase.isEmpty()) { resultMatcher.publish(res); } else if (nm.matches(res.localeName) || nm.matches(res.otherNames)) { + res.firstUnknownWordMatches = wrd.equals(phrase.getUnknownSearchWord()); subSearchApiOrPublish(phrase, resultMatcher, res, cityApi); } if (limit++ > LIMIT * phrase.getRadiusLevel()) { @@ -447,9 +448,7 @@ public class SearchCoreFactory { } r.searchAddressDataByName(req); for (SearchResult res : immediateResults) { - res.firstUnknownWordMatches = wordToSearch.equals(phrase.getUnknownSearchWord()) || - phrase.getNameStringMatcher().matches(res.localeName) || - phrase.getNameStringMatcher().matches(res.otherNames); + res.firstUnknownWordMatches = wordToSearch.equals(phrase.getUnknownSearchWord()); if (res.objectType == ObjectType.STREET) { City ct = ((Street) res.object).getCity(); phrase.countUnknownWordsMatch(res, diff --git a/OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java b/OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java index 5477a2b698..2ac4d1c4c0 100644 --- a/OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java +++ b/OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java @@ -664,8 +664,8 @@ public class SearchPhrase { @Override public int compare(String o1, String o2) { - int i1 = CommonWords.getCommonSearch(o1); - int i2 = CommonWords.getCommonSearch(o2); + int i1 = CommonWords.getCommonSearch(o1.toLowerCase()); + int i2 = CommonWords.getCommonSearch(o2.toLowerCase()); if (i1 != i2) { return icompare(i1, i2); }