Android
Signature
Explore example code
Browse the SortBy example code on GitHub.
About this widget
This widget displays a list of indices, allowing a user to change the way hits are sorting (with replica indices). Another common use case for this widget is to let users switch between different indices. For this widget to work, you must define all indices that you pass down as options as replicas of the main .Examples
Kotlin
Low-level API
To addSortBy to your search experience, use these components:
Searcher. TheSearcherthat handles your searches.SortByViewModel. The logic applied to the index sorting/switching.SortByViewAutocomplete. The concrete view implementing SortByView.IndexPresenter. Optional. The presenter that converts an Index to a String output.
Kotlin
Compose UI
Kotlin
Parameters
The list of indices to search in.
The index to select. By default, none is selected.
View
The view that renders the list of indices.InstantSearch includes the
SortByViewSpinner and SortByViewAutocomplete implementations.The presenter that defines the way we want to display an index,
taking as input an Index and returning a String.
Kotlin