mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-19 12:26:13 -04:00
Use distinctBy filter to show unique searches
This commit is contained in:
parent
dd28c4145d
commit
f4d1091fb9
@ -34,13 +34,12 @@ class NewRecentSearchDao @Inject constructor(
|
||||
orderDesc(RecentSearchEntity_.id)
|
||||
}
|
||||
).map { searchEntities ->
|
||||
searchEntities.distinct()
|
||||
searchEntities.distinctBy(RecentSearchEntity::searchTerm)
|
||||
.take(NUM_RECENT_RESULTS)
|
||||
.map { searchEntity -> RecentSearchListItem(searchEntity.searchTerm) }
|
||||
}
|
||||
|
||||
fun saveSearch(title: String, id: String) {
|
||||
deleteSearchString(title)
|
||||
box.put(RecentSearchEntity(searchTerm = title, zimId = id))
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user