mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-26 11:07:51 +02:00
Add prefix search to search by internal DB ID (#1856)
This prefix searches entries in the library based on the ID in the
database. It is a niche feature but could be very helpful in certain
situations, such as a corrupted cover causing a crash that just shows
"🚨 Failed - MangaCover(mangaId=2245, sourceId=1, isMangaFavorite=true, url=, lastModified=0)".
With this prefix search it is possible to find the entry in question
without much hassle.
Notably, the database includes literally anything Mihon has ever seen
from extension and such, even if they weren't added to the collection.
This means that IDs actually present in the collection are not
expected to be purely sequential.
For example, in my emulator, I had two entries in the collection but
the assigned IDs were 5 and 56.
This commit is contained in:
@ -23,6 +23,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
||||
- Add back support for drag-and-drop category reordering ([@cuong-tran](https://github.com/cuong-tran)) ([#1427](https://github.com/mihonapp/mihon/pull/1427))
|
||||
- Add option to mark duplicate read chapters as read
|
||||
- Display staff information on Anilist tracker search results ([@NarwhalHorns](https://github.com/NarwhalHorns)) ([#1810](https://github.com/mihonapp/mihon/pull/1810))
|
||||
- Add `id:` prefix search to library to search by internal DB ID ([@MajorTanya](https://github.com/MajorTanya)) ([#1856](https://github.com/mihonapp/mihon/pull/1856))
|
||||
|
||||
### Changed
|
||||
- Sliders UI
|
||||
|
@ -22,6 +22,10 @@ data class LibraryItem(
|
||||
*/
|
||||
fun matches(constraint: String): Boolean {
|
||||
val sourceName by lazy { sourceManager.getOrStub(libraryManga.manga.source).getNameForMangaInfo() }
|
||||
if (constraint.startsWith("id:", true)) {
|
||||
val id = constraint.substringAfter("id:").toLongOrNull()
|
||||
return libraryManga.id == id
|
||||
}
|
||||
return libraryManga.manga.title.contains(constraint, true) ||
|
||||
(libraryManga.manga.author?.contains(constraint, true) ?: false) ||
|
||||
(libraryManga.manga.artist?.contains(constraint, true) ?: false) ||
|
||||
|
Reference in New Issue
Block a user