Skip to content

Commit d652483

Browse files
docs(getAlgoliaResults): rewrite guides (#475)
* docs(autocomplete-preset-algolia): add common note * docs(getAlgoliaResults): rewrite guides * docs(getAlgoliaResults): fix intro * docs(getAlgoliaResults): fix page * docs(getAlgoliaResults): small fixes * fix: apply suggestions from code review Co-authored-by: François Chalifour <[email protected]> Co-authored-by: François Chalifour <[email protected]>
1 parent d04f709 commit d652483

File tree

3 files changed

+65
-11
lines changed

3 files changed

+65
-11
lines changed

packages/website/docs/getAlgoliaResults-js.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,22 @@ id: getAlgoliaResults-js
33
title: getAlgoliaResults
44
---
55

6-
Retrieves Algolia results from multiple indices.
6+
import GetAlgoliaResultsIntro from './partials/preset-algolia/getAlgoliaResults/intro.md'
7+
8+
<GetAlgoliaResultsIntro />
79

810
## Example
911

12+
This example uses the function along with the [`algoliasearch`](https://www.npmjs.com/package/algoliasearch) API client.
13+
1014
```js
1115
import { getAlgoliaResults } from '@algolia/autocomplete-js';
1216
import algoliasearch from 'algoliasearch/lite';
1317

14-
const searchClient = algoliasearch(APP_ID, SEARCH_API_KEY);
18+
const searchClient = algoliasearch(
19+
'latency',
20+
'6be0576ff61c053d5f9a3225e2a90f76'
21+
);
1522

1623
getAlgoliaResults({
1724
searchClient,
@@ -29,6 +36,6 @@ getAlgoliaResults({
2936
});
3037
```
3138

32-
## Params
39+
## Parameters
3340

34-
See [`autocomplete-preset-algolia#getAlgoliaResults`](getAlgoliaResults#params).
41+
See [`autocomplete-preset-algolia#getAlgoliaResults`](getAlgoliaResults#parameters).

packages/website/docs/getAlgoliaResults.md

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,47 @@
22
id: getAlgoliaResults
33
---
44

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+
```
633

734
## Example
835

36+
This example uses the function along with the [`algoliasearch`](https://www.npmjs.com/package/algoliasearch) API client.
37+
938
```js
1039
import { getAlgoliaResults } from '@algolia/autocomplete-preset-algolia';
1140
import algoliasearch from 'algoliasearch/lite';
1241

13-
const searchClient = algoliasearch(APP_ID, SEARCH_API_KEY);
42+
const searchClient = algoliasearch(
43+
'latency',
44+
'6be0576ff61c053d5f9a3225e2a90f76'
45+
);
1446

1547
getAlgoliaResults({
1648
searchClient,
@@ -28,27 +60,39 @@ getAlgoliaResults({
2860
});
2961
```
3062

31-
## Params
63+
## Parameters
3264

3365
### `searchClient`
3466

3567
> `SearchClient` | required
3668
69+
The initialized Algolia search client.
70+
3771
### `queries`
3872

73+
> `MultipleQueriesQuery[]` | required
74+
75+
The queries to perform, with the following parameters:
76+
3977
#### `indexName`
4078

4179
> `string` | required
4280
81+
The index name to search into.
82+
4383
#### `query`
4484

45-
> `string` | required
85+
> `string`
86+
87+
The query to search for.
4688

4789
#### `params`
4890

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.
5094

51-
Default search parameters:
95+
These are the default search parameters. You can leave them as is and specify other parameters, or override them.
5296

5397
```json
5498
{
@@ -60,7 +104,7 @@ Default search parameters:
60104

61105
## Returns
62106

63-
It returns a promise of the following schema:
107+
The function returns a promise that resolves to a response with the following schema:
64108

65109
```json
66110
{
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Retrieves Algolia results from multiple indices.
2+
3+
The `getAlgoliaResults` function lets you query several Algolia indices at once.

0 commit comments

Comments
 (0)