Retrieve Algolia facet hits from one or several indices with autocomplete-js.
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.
When using getAlgoliaFacets and getAlgoliaResults with the same search
client in different sources or plugins, Autocomplete batches all queries into
a single network call to Algolia. If you’re using the same search client for
different sources or plugins, make sure to use the same instance to leverage
the internal cache and batching mechanism.
The attribute name to search facet values into.The attribute must be declared in the attributesForFaceting
index setting with the searchable() modifier.
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: