getAlgoliaHits
Retrieves Algolia hits from multiple indices as arrays of records.
The getAlgoliaHits
function lets you query several Algolia indices at once and returns the hits as an array of records.
note
If you're using autocomplete-js
, all Algolia utilities are available directly in the package with the right user agents and the virtual DOM layer. You don't need to import the preset separately.
#
InstallationFirst, you need to install the preset.
Then import it in your project:
If you don't use a package manager, you can use a standalone endpoint:
#
ExampleThis example uses the function along with the algoliasearch
API client.
#
ParameterssearchClient
#
SearchClient
| required
The initialized Algolia search client.
queries
#
MultipleQueriesQuery[]
| required
The queries to perform, with the following parameters:
indexName
#
string
| required
The index name to search into.
query
#
string
The query to search for.
params
#
Algolia search parameters.
These are the default search parameters. You can leave them as is and specify other parameters, or override them.
#
ReturnsThe function returns a promise that resolves to a response with the following schema: