Implemented matching only the start of a city name (with contains() there have been too many unwanted search results)

This commit is contained in:
dankito 2020-09-17 01:51:12 +02:00
parent 826af7c8b8
commit 596f85ca6d
2 changed files with 2 additions and 2 deletions

View File

@ -39,7 +39,7 @@ open class InMemoryBankFinder() : BankFinderBase(), IBankFinder {
protected open fun checkIfQueryMatchesBankNameOrCity(bankInfo: BankInfo, queryLowerCase: String): Boolean {
return bankInfo.name.toLowerCase().contains(queryLowerCase)
|| bankInfo.city.toLowerCase().contains(queryLowerCase)
|| bankInfo.city.toLowerCase().startsWith(queryLowerCase)
}

View File

@ -93,7 +93,7 @@ open class LuceneBankFinder(indexFolder: File) : BankFinderBase(), IBankFinder {
val luceneQuery = queries.createQueriesForSingleTerms(query.toLowerCase()) { singleTerm ->
listOf(
queries.fulltextQuery(BankInfoNameFieldName, singleTerm),
queries.contains(BankInfoCityIndexedFieldName, singleTerm)
queries.startsWith(BankInfoCityIndexedFieldName, singleTerm)
)
}