Bugfix/categories search (#3913)

* Fixes #3734
* Donot ignore case while searching categories

* Fixed test-cases to ensure search terms are passed as it is to the CategoryClient

* Used a First_Char_Caps title list term just to ensure test case tests as intended

* Fixed searchAll with empty term test case
This commit is contained in:
Ashish 2020-08-31 21:30:36 +05:30 committed by GitHub
parent 7f90361ffd
commit 4109d23023
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 10 deletions

View file

@ -91,7 +91,7 @@ class CategoriesModel @Inject constructor(
Function4(::combine)
)
else
categoryClient.searchCategoriesForPrefix(term.toLowerCase(), SEARCH_CATS_LIMIT)
categoryClient.searchCategoriesForPrefix(term, SEARCH_CATS_LIMIT)
.map { it.sortedWith(StringSortingUtils.sortBySimilarity(term)) }
.toObservable()
}
@ -122,12 +122,11 @@ class CategoriesModel @Inject constructor(
/**
* Return category for single title
* title is converted to lower case to make search case-insensitive
* @param title
* @return
*/
private fun getTitleCategories(title: String): Observable<List<String>> {
return categoryClient.searchCategories(title.toLowerCase(), SEARCH_CATS_LIMIT).toObservable()
return categoryClient.searchCategories(title, SEARCH_CATS_LIMIT).toObservable()
}
@ -160,6 +159,6 @@ class CategoriesModel @Inject constructor(
}
companion object {
private const val SEARCH_CATS_LIMIT = 25
const val SEARCH_CATS_LIMIT = 25
}
}