Signature
View live demo
Open the live Hits Searcher example in your browser.
About this widget
The component handling a ,HitsSearcher has the following behavior:
- Distinct state changes (including initial state) will trigger a search operation
- State changes are debounced
- On a new search request, any previous ongoing search calls will be cancelled
HitsSearcher. Searches a single .FacetSearcher. Searches for values.MultiSearcher. Aggregates the hits and facet searchers. This is useful for building a federated search, or query suggestions.
Examples
- Create a
HitsSearcher - Update search state with
queryandapplyState - Listen to search
responsesand build the UI disposeof underlying resources
Dart
HitsSearcher
String
required
The ID of your application.
Dart
String
required
Your application’s Search-only API key.
Dart
String
required
The index to search into.
Dart
SearchState
required
Initial search state.
Dart
bool
default:true
Whether disjunctive faceting is enabled.
Dart
Duration
default: Duration(milliseconds: 100)
Search operation debounce duration.
Dart
Fields
Stream<SearchResponse>
Stream of search responses.
Dart
Stream<SearchState>
Stream of search states.
Dart
HitsEventTracker
Instance responsible for handling and sending user related to search interactions,
such as clicks, conversions, and views.
These events help to personalize the user’s search experience by providing insights into user behavior.
eventTracker is automatically integrated with the HitsSearcher to track events when users interact with the search results.Dart
Methods
Triggers a search operation with given .
Dart
Applies a search state configuration and triggers a search operation.
Dart
Releases all underlying resources
Dart
FacetSearcher
String
required
The ID of your application.
Dart
String
required
Your application’s Search-only API key.
Dart
String
required
The index to search into.
Dart
String
required
The facet name to search into when doing search for facet values.
Dart
FacetSearchState
required
Initial facet search state.
Dart
Duration
default: Duration(milliseconds: 100)
Search operation debounce duration.
Dart
Fields
Stream<FacetSearchResponse>
Stream of search responses.
Dart
Stream<FacetSearchState>
Stream of facet search states
Dart
Methods
Triggers a search operation with given search query
Dart
Applies a search state configuration and triggers a search operation
Dart
Releases all underlying resources
Dart
MultiSearcher
MultipleQueriesStrategy
default: None
MultiSearcher lets you simultaneously search for hits and facet values in different indices of the same Algolia application.
It instantiates and manages HitsSearcher and FacetSearcher instances. Once created, these searchers behave like their independently instantiated counterparts.Dart
Methods
Releases all underlying resources
Dart
Adds a new
HitsSearcher to the multi-searcher.Dart
Adds a new
FacetSearcher to the multi-searcher.Dart