About this widget
TheRelatedItems
component computes search parameters to fetch related items.
You can pass a hit as the reference for computing search parameters and retrieving the related items.
To add RelatedItems
to your search experience, use the following components:
Searcher
. A newHitsSearcher
that handles your searches for related items.HitsView
. Adata class
representing a search result.T
. AnIndexable
data class representing the hit to get related items.
Hits
component,
but it only modifies the results.
Examples
You can usedeserialize
to convert raw hits into your own data class using the Serializable
annotation.
Kotlin
Compose UI
Kotlin
Parameters
The reference hit to compute the search parameters to send to Algolia.You can retrieve this hit from any location (app state, your backend, the history, etc.)
Kotlin
A schema that creates scored filters
based on the hit’s attributes.In the example below, the The hit above would generate the following search parameters:
brand
value gets a score of 1 while the category
values get a score of 2.Kotlin
JSON
A function that transforms the search response into a list of results of your
T
class.Kotlin