About this widget
This component is handled by objects that implement theSearcher interface.
These objects manage the search session and process each as it occurs.
Algolia provides you with several out of the box searchers to help build your InstantSearch experience:
HitsSearcher: searches a single .FacetSearcher: searches for values.MultiSearcher: searches in multiple indices. This is useful for a federated search, or query suggestions search experience.
Examples
Instantiating aHitsSearcher:
Kotlin
FacetSearcher:
Kotlin
MultiSearcher:
Kotlin
HitsSearcher
The index to search into.
Kotlin
A .
Kotlin
Flag defining whether the automatic hits view Insights sending is enabled.
The default value was
true until version 3.3.1.Kotlin
The user token assigned to automatically send click and conversion events in the
HitsSearcher component.
If not explicitly set during initialization,
the HitsSearcher generates and assigns a default user token.RequestOptions that apply to the search.
Kotlin
FacetSearcher
The index to search into.
Kotlin
An attribute to search facet values for.
Kotlin
A query used to perform the search.
Kotlin
RequestOptions that apply to the search.Kotlin
MultiSearcher
The strategy of the query.Can be one of the following values:
None. Execute the sequence of queries until the end. This is recommended when each query is of equal importance, meaning all of all queries need to be returned.StopIfEnoughMatches. Execute queries one by one, but stop as soon as the cumulated number of hits is at leasthitsPerPage. This is recommended when each query is an alternative, and where, if the first returns enough records, there is no need to perform the remaining queries.
Kotlin
RequestOptions that apply to the search.Kotlin
Methods
search
Triggers the search and returns a search response.
Kotlin
searchAsync
Triggers the search.
Notifies all listeners of the results.
Kotlin
cancel
Cancels the ongoing search requests.
Kotlin
setQuery
Sets the query to the string provided.
Kotlin
Events
onLoadingChanged
Triggered when the status of the search request is changed.
Kotlin
onResponseChanged
Triggered when a new response has arrived.
Kotlin
The deserialize extension is deprecated in 4.x.
Consider parsing hits directly from
SearchResponse.hits, which returns List<Hit> from the Algolia client.onErrorChanged
Triggered when an error was encountered during a search request.
Kotlin