About this widget
TheRelatedItems components computes search parameters to fetch related items.
You pass it a hit, which will be the reference in computing the search parameters and retrieving the related items.
To add RelatedItems to your search experience, use these components:
Searcher. A newSearcherthat handles your searches for related items.HitsInteractor. The hits interactor to display the related items.HitsController. The controller that interfaces with a concrete hits view.
Hits component,
but it only modifies the results.
Examples
ConnectHitsInteractor and HitsController with each other using the provided connection method,
and connect the HitsInteractor with Searcher.
In this example, we use the HitsTableController provided by InstantSearch.
Now, each time you launch a new search:
Searcherreceives new results and transmit them toHitsInteractorHitsInteractorparses search results and notifiesHitsControllerHitsControllerrefreshes the view presenting the hits
Swift
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.).
Swift
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 gets a score of 2.Swift
JSON
Customizing your view
Related items list appear in the controller implementingHitsController protocol.
Read more about customizing Hits view in the HitsController documentation.