Skip to main content

About this widget

This component is handled by objects that implement the Searcher 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.

Explore example code

Browse the Searcher example code on GitHub.

Examples

Instantiating a HitsSearcher:
Kotlin
Instantiating a FacetSearcher:
Kotlin
Instantiating a MultiSearcher:
Kotlin

HitsSearcher

indexName
String
required
The index to search into.
Kotlin
query
SearchParamsObject
default:"SearchParamsObject()"
A .
Kotlin
isAutoSendingHitsViewEvents
Boolean
default:false
Flag defining whether the automatic hits view Insights sending is enabled.
The default value was true until version 3.3.1.
Kotlin
userToken
String
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
RequestOptions
default:"null"
RequestOptions that apply to the search.
Kotlin

FacetSearcher

indexName
String
required
The index to search into.
Kotlin
attribute
String
required
An attribute to search facet values for.
Kotlin
query
SearchParamsObject
default:"SearchParamsObject()"
A query used to perform the search.
Kotlin
requestOptions
RequestOptions
default:"null"
RequestOptions that apply to the search.
Kotlin

MultiSearcher

strategy
MultipleQueriesStrategy
default:"None"
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 least hitsPerPage. 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
RequestOptions
default:"RequestOptions()"
RequestOptions that apply to the search.
Kotlin

Methods

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
Last modified on July 10, 2026