Fix sorting in search

This commit is contained in:
Willi Ye 2021-02-10 21:11:58 +01:00 committed by ◱ Mark
parent d225bc9bef
commit 8dd4858612

View File

@ -79,9 +79,7 @@ class GenericAdapter : RecyclerView.Adapter<GenericViewHolder<ViewBinding>>(), F
val similarity = (jw.similarity(currentSearchTerm, it) + cos.similarity(currentSearchTerm, it)) / 2 val similarity = (jw.similarity(currentSearchTerm, it) + cos.similarity(currentSearchTerm, it)) / 2
if (similarity != 0.0) ScoredItem(similarity, item) else null if (similarity != 0.0) ScoredItem(similarity, item) else null
} }
}.apply { }.sortedByDescending { it.score }
sortedByDescending { it.score }
}
/** /**
* This performs filtering on the items in [allItems] based on similarity to [term] * This performs filtering on the items in [allItems] based on similarity to [term]