Added comparison between search term and display name to comparator to prioritise results with search term in name
This commit is contained in:
+7
-2
@@ -74,8 +74,13 @@ class SearchBarViewModel(
|
|||||||
_searchResultsUsers.emit(
|
_searchResultsUsers.emit(
|
||||||
LocalCache
|
LocalCache
|
||||||
.findUsersStartingWith(searchValue)
|
.findUsersStartingWith(searchValue)
|
||||||
.sortedWith(compareBy({ account.isFollowing(it) }, { it.toBestDisplayName() }))
|
.sortedWith(
|
||||||
.reversed(),
|
compareBy(
|
||||||
|
{ it.toBestDisplayName().startsWith(searchValue, true) },
|
||||||
|
{ account.isFollowing(it) },
|
||||||
|
{ it.toBestDisplayName() },
|
||||||
|
),
|
||||||
|
).reversed(),
|
||||||
)
|
)
|
||||||
_searchResultsNotes.emit(
|
_searchResultsNotes.emit(
|
||||||
LocalCache
|
LocalCache
|
||||||
|
|||||||
Reference in New Issue
Block a user