2
2
id : getAlgoliaResults
3
3
---
4
4
5
- Retrieves Algolia results from multiple indices.
5
+ import GetAlgoliaResultsIntro from './partials/preset-algolia/getAlgoliaResults/intro.md'
6
+ import PresetAlgoliaNote from './partials/preset-algolia/note.md'
7
+
8
+ <GetAlgoliaResultsIntro />
9
+
10
+ <PresetAlgoliaNote />
11
+
12
+ ## Installation
13
+
14
+ First, you need to install the preset.
15
+
16
+ ``` bash
17
+ yarn add @algolia/autocomplete-preset-algolia@alpha
18
+ # or
19
+ npm install @algolia/autocomplete-preset-algolia@alpha
20
+ ```
21
+
22
+ Then import it in your project:
23
+
24
+ ``` js
25
+ import { getAlgoliaResults } from ' @algolia/autocomplete-preset-algolia' ;
26
+ ```
27
+
28
+ If you don't use a package manager, you can use a standalone endpoint:
29
+
30
+ ``` html
31
+ <script src =" https://cdn.jsdelivr.net/npm/@algolia/autocomplete-preset-algolia@alpha" ></script >
32
+ ```
6
33
7
34
## Example
8
35
36
+ This example uses the function along with the [ ` algoliasearch ` ] ( https://www.npmjs.com/package/algoliasearch ) API client.
37
+
9
38
``` js
10
39
import { getAlgoliaResults } from ' @algolia/autocomplete-preset-algolia' ;
11
40
import algoliasearch from ' algoliasearch/lite' ;
12
41
13
- const searchClient = algoliasearch (APP_ID , SEARCH_API_KEY );
42
+ const searchClient = algoliasearch (
43
+ ' latency' ,
44
+ ' 6be0576ff61c053d5f9a3225e2a90f76'
45
+ );
14
46
15
47
getAlgoliaResults ({
16
48
searchClient,
@@ -28,27 +60,39 @@ getAlgoliaResults({
28
60
});
29
61
```
30
62
31
- ## Params
63
+ ## Parameters
32
64
33
65
### ` searchClient `
34
66
35
67
> ` SearchClient ` | required
36
68
69
+ The initialized Algolia search client.
70
+
37
71
### ` queries `
38
72
73
+ > ` MultipleQueriesQuery[] ` | required
74
+
75
+ The queries to perform, with the following parameters:
76
+
39
77
#### ` indexName `
40
78
41
79
> ` string ` | required
42
80
81
+ The index name to search into.
82
+
43
83
#### ` query `
44
84
45
- > ` string ` | required
85
+ > ` string `
86
+
87
+ The query to search for.
46
88
47
89
#### ` params `
48
90
49
- > [ ` SearchParameters ` ] ( https://www.algolia.com/doc/api-reference/search-api-parameters/ ) | required
91
+ > [ ` SearchParameters ` ] ( https://www.algolia.com/doc/api-reference/search-api-parameters/ )
92
+
93
+ Algolia search parameters.
50
94
51
- Default search parameters:
95
+ These are the default search parameters. You can leave them as is and specify other parameters, or override them.
52
96
53
97
``` json
54
98
{
@@ -60,7 +104,7 @@ Default search parameters:
60
104
61
105
## Returns
62
106
63
- It returns a promise of the following schema:
107
+ The function returns a promise that resolves to a response with the following schema:
64
108
65
109
``` json
66
110
{
0 commit comments