Implemented matching only the start of a city name (with contains() there have been too many unwanted search results)
This commit is contained in:
parent
826af7c8b8
commit
596f85ca6d
|
@ -39,7 +39,7 @@ open class InMemoryBankFinder() : BankFinderBase(), IBankFinder {
|
||||||
|
|
||||||
protected open fun checkIfQueryMatchesBankNameOrCity(bankInfo: BankInfo, queryLowerCase: String): Boolean {
|
protected open fun checkIfQueryMatchesBankNameOrCity(bankInfo: BankInfo, queryLowerCase: String): Boolean {
|
||||||
return bankInfo.name.toLowerCase().contains(queryLowerCase)
|
return bankInfo.name.toLowerCase().contains(queryLowerCase)
|
||||||
|| bankInfo.city.toLowerCase().contains(queryLowerCase)
|
|| bankInfo.city.toLowerCase().startsWith(queryLowerCase)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ open class LuceneBankFinder(indexFolder: File) : BankFinderBase(), IBankFinder {
|
||||||
val luceneQuery = queries.createQueriesForSingleTerms(query.toLowerCase()) { singleTerm ->
|
val luceneQuery = queries.createQueriesForSingleTerms(query.toLowerCase()) { singleTerm ->
|
||||||
listOf(
|
listOf(
|
||||||
queries.fulltextQuery(BankInfoNameFieldName, singleTerm),
|
queries.fulltextQuery(BankInfoNameFieldName, singleTerm),
|
||||||
queries.contains(BankInfoCityIndexedFieldName, singleTerm)
|
queries.startsWith(BankInfoCityIndexedFieldName, singleTerm)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue