Skip to main content

About this widget

The RelatedItems 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 new HitsSearcher that handles your searches for related items.
  • HitsView. A data class representing a search result.
  • T. An Indexable data class representing the hit to get related items.
This component acts similarly to the Hits component, but it only modifies the results.

Explore example code

Browse the RelatedItems example code on GitHub.

Examples

You can use deserialize to convert raw hits into your own data class using the Serializable annotation.
Kotlin

Compose UI

Kotlin

Parameters

hit
T : Indexable
required
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
matchingPatterns
List<MatchingPattern<T>>
required
A schema that creates scored filters based on the hit’s attributes.In the example below, the brand value gets a score of 1 while the category values get a score of 2.
Kotlin
The hit above would generate the following search parameters:
JSON
presenter
(SearchResponse) -> List<T>
required
A function that transforms the search response into a list of results of your T class.
Kotlin
Last modified on July 10, 2026