Signature
Explore example code
Browse the RelevantSort example code on GitHub.
About this widget
Virtual indices let you use relevant sort, a sorting mechanism that favors relevancy over the attribute you’re sorting on. TherelevantSort widget displays the current search mode when searching in a virtual replica index,
and allows users to switch between relevant and regular sorting,
which is more exhaustive but can return less relevant results.
Examples
Instantiate aRelevantSortConnector and connect it to a RelevantSortView.
Android view
Kotlin
Compose UI
InstantSearch provides theRelevantSortState as a state model, which is an implementation of the RelevantSortView interface.
RelevantSortState must be connected to the RelevantSortConnector or RelevantSortViewModel like any other RelevantSortView implementation.
Kotlin
Parameters
RelevantSortViewModel
default: RelevantSortViewModel()
The business logic handling the Relevant sort priority changes.
View
RelevantSortView<T>
required
The view that presents and toggles the relevant sort priority state.
If you don’t need to transform anything,
you can use
RelevantSortPriorityView instead,
which is a type alias of RelevantSortView<RelevantSortPriority?>.RelevantSortPresenter<T>
required
Presenter transforming the Relevant sort priority state to its representation for a view.
Not required if you use
RelevantSortPriorityView.Kotlin
Low-level API
If you want to fully control theRelevantSort components and connect them manually, you can use the following components:
Searcher. TheSearcherthat handles your searches.RelevantSortViewModel. The business logic handling the Relevant sort priority changes.RelevantSortView<T>. The view that presents and toggles the Relevant sort priority state.RelevantSortPriorityViewis a type alias ofRelevantSortView<RelevantSortPriority?>.RelevantSortPresenter<T>. Generic presenter transforming the Relevant sort priority state to its representation for a view. Optional if you useRelevantSortPriorityView.
Kotlin