diff --git a/OsmAnd-java/src/main/java/net/osmand/CollatorStringMatcher.java b/OsmAnd-java/src/main/java/net/osmand/CollatorStringMatcher.java index d6011c6209..693be4bd82 100644 --- a/OsmAnd-java/src/main/java/net/osmand/CollatorStringMatcher.java +++ b/OsmAnd-java/src/main/java/net/osmand/CollatorStringMatcher.java @@ -124,6 +124,9 @@ public class CollatorStringMatcher implements StringMatcher { public static boolean cstartsWith(Collator collator, String searchInParam, String theStart, boolean checkBeginning, boolean checkSpaces, boolean equals, boolean trim) { String searchIn = searchInParam.toLowerCase(Locale.getDefault()); + if (trim && searchIn.length() > 0) { + searchIn += " "; + } int searchInLength = searchIn.length(); if (trim && searchInLength > 0 && theStart.length() > searchInLength) { theStart = theStart.substring(0, searchInLength); diff --git a/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java b/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java index 27a07b66b6..f6379410fa 100644 --- a/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java +++ b/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java @@ -500,7 +500,7 @@ public class SearchUICore { } currentSearchResult = collection; if (phrase.getSettings().isExportObjects()) { - rm.createTestJSON(collection); + //rm.createTestJSON(collection); } rm.searchFinished(phrase); if (onResultsComplete != null) { diff --git a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java index 2d2e2cdff1..035f106989 100644 --- a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java +++ b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java @@ -662,8 +662,13 @@ public class SearchCoreFactory { categories = types.getCategories(false); } List results = new ArrayList(); - NameStringMatcher nm = - new NameStringMatcher(phrase.getUnknownSearchPhrase(), StringMatcherMode.CHECK_STARTS_FROM_SPACE); + NameStringMatcher nm; + String unknownSearchPhrase = phrase.getUnknownSearchPhrase(); + if (phrase.getUnknownSearchWord().length() < unknownSearchPhrase.length()) { + nm = new NameStringMatcher(unknownSearchPhrase, StringMatcherMode.CHECK_ONLY_STARTS_WITH_TRIM); + } else { + nm = new NameStringMatcher(unknownSearchPhrase, StringMatcherMode.CHECK_STARTS_FROM_SPACE); + } for (AbstractPoiType pf : topVisibleFilters) { if (!phrase.isUnknownSearchWordPresent() || nm.matches(pf.getTranslation()) diff --git a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchExportSettings.java b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchExportSettings.java index 7c6e938a65..2519d12edc 100644 --- a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchExportSettings.java +++ b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchExportSettings.java @@ -9,6 +9,11 @@ public class SearchExportSettings { exportBuildings = true; } + public SearchExportSettings(boolean exportEmptyCities, boolean exportBuildings) { + this.exportEmptyCities = exportEmptyCities; + this.exportBuildings = exportBuildings; + } + public boolean isExportEmptyCities() { return exportEmptyCities; } diff --git a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchSettings.java b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchSettings.java index 3d3b9d5de1..3779bb801a 100644 --- a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchSettings.java +++ b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchSettings.java @@ -24,6 +24,7 @@ public class SearchSettings { private boolean emptyQueryAllowed; private boolean sortByName; private SearchExportSettings exportSettings; + //private SearchExportSettings exportSettings = new SearchExportSettings(false, false); public SearchSettings(SearchSettings s) { if(s != null) {