Fix search bank abcd

This commit is contained in:
crimean 2018-12-05 12:05:17 +03:00
parent 6ac823bb9c
commit 4c2cfb9c97
5 changed files with 17 additions and 3 deletions

View file

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

View file

@ -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) {

View file

@ -662,8 +662,13 @@ public class SearchCoreFactory {
categories = types.getCategories(false);
}
List<AbstractPoiType> results = new ArrayList<AbstractPoiType>();
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())

View file

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

View file

@ -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) {