mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
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:
parent
7f90361ffd
commit
4109d23023
2 changed files with 34 additions and 10 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue