diff --git a/app/src/main/java/io/legado/app/data/entities/SearchBook.kt b/app/src/main/java/io/legado/app/data/entities/SearchBook.kt index d95c566c0..4404631a8 100644 --- a/app/src/main/java/io/legado/app/data/entities/SearchBook.kt +++ b/app/src/main/java/io/legado/app/data/entities/SearchBook.kt @@ -29,7 +29,7 @@ data class SearchBook( var variable: String? = null, var bookInfoHtml: String? = null, var originOrder: Int = 0, - var bookOrder: Int = 0 + var searchOrder: Int = 0 ) : Parcelable, BaseBook { @Ignore diff --git a/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt b/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt index 8ea099c5f..179d4abb9 100644 --- a/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/search/SearchViewModel.kt @@ -21,7 +21,11 @@ class SearchViewModel(application: Application) : BaseViewModel(application) { .onSuccess { searchBookS -> searchBookS?.let { for (searchBook in searchBookS) { - + when (key) { + searchBook.name -> searchBook.searchOrder = 0 + searchBook.author -> searchBook.searchOrder = 1 + else -> searchBook.searchOrder = 1000 + } } App.db.searchBookDao().insert(*it.toTypedArray()) }