Retrieve Algolia facet hits from one or several indices with autocomplete-preset-algolia.
The getAlgoliaFacets function lets you query facet hits from one or several Algolia indices.Using getAlgoliaFacets lets Autocomplete batch all queries using the same search client into a single network call,
and thus minimize search unit consumption. It also works out of the box with the components
exposed in templates.
If you’re using autocomplete-js,
you don’t need to import the preset separately.
The package includes all Algolia utilities, with the appropriate user agents and virtual DOM support.
The name of the facet attribute for which to search facet values.The attribute must be declared in the attributesForFaceting
index setting with the searchable() modifier.
Algolia search for facet values parameters.These are the default parameters.
You can leave them as they are and specify other parameters, or override them.
The function to transform the Algolia response before passing it to the Autocomplete state.
You have access to the full Algolia results,
as well as the pre-computed hits and facet hits.
This is useful to manipulate the hits,
or store data from the results in the context.This is the default implementation: