Skip to content

Commit b230909

Browse files
docs(getAlgoliaFacetHits): rewrite guides (#476)
* docs(autocomplete-preset-algolia): add common note * docs(getAlgoliaFacetHits): rewrite guides * docs(getAlgoliaFacetHits): fix page * docs(getAlgoliaFacetHits): small fixes * fix: apply suggestions from code review Co-authored-by: François Chalifour <[email protected]> * docs(getAlgoliaFacetHits): add note on highlighting Co-authored-by: François Chalifour <[email protected]>
1 parent 610dba3 commit b230909

File tree

3 files changed

+64
-10
lines changed

3 files changed

+64
-10
lines changed

packages/website/docs/getAlgoliaFacetHits-js.md

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

6-
Retrieves Algolia facet hits from multiple indices.
6+
import GetAlgoliaFacetHitsIntro from './partials/preset-algolia/getAlgoliaFacetHits/intro.md'
7+
8+
<GetAlgoliaFacetHitsIntro />
79

810
## Example
911

1012
```js
1113
import { getAlgoliaFacetHits } from '@algolia/autocomplete-js';
1214
import algoliasearch from 'algoliasearch/lite';
1315

14-
const searchClient = algoliasearch(APP_ID, SEARCH_API_KEY);
16+
const searchClient = algoliasearch(
17+
'latency',
18+
'6be0576ff61c053d5f9a3225e2a90f76'
19+
);
1520

1621
getAlgoliaFacetHits({
1722
searchClient,
@@ -30,6 +35,6 @@ getAlgoliaFacetHits({
3035
});
3136
```
3237

33-
## Params
38+
## Parameters
3439

35-
See [`autocomplete-preset-algolia#getAlgoliaFacetHits`](getAlgoliaFacetHits#params).
40+
See [`autocomplete-preset-algolia#getAlgoliaFacetHits`](getAlgoliaFacetHits#parameters).

packages/website/docs/getAlgoliaFacetHits.md

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,45 @@
22
id: getAlgoliaFacetHits
33
---
44

5-
Retrieves Algolia facet hits from multiple indices.
5+
import GetAlgoliaFacetHitsIntro from './partials/preset-algolia/getAlgoliaFacetHits/intro.md'
6+
import PresetAlgoliaNote from './partials/preset-algolia/note.md'
7+
8+
<GetAlgoliaFacetHitsIntro />
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 { getAlgoliaFacetHits } 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

936
```js
1037
import { getAlgoliaFacetHits } from '@algolia/autocomplete-preset-algolia';
1138
import algoliasearch from 'algoliasearch/lite';
1239

13-
const searchClient = algoliasearch(APP_ID, SEARCH_API_KEY);
40+
const searchClient = algoliasearch(
41+
'latency',
42+
'6be0576ff61c053d5f9a3225e2a90f76'
43+
);
1444

1545
getAlgoliaFacetHits({
1646
searchClient,
@@ -29,23 +59,39 @@ getAlgoliaFacetHits({
2959
});
3060
```
3161

32-
## Params
62+
## Parameters
3363

3464
### `searchClient`
3565

3666
> `SearchClient` | required
3767
68+
The initialized Algolia search client.
69+
3870
### `queries`
3971

72+
> `FacetQuery[]` | required
73+
74+
The queries to search for, with the following parameters:
75+
4076
#### `indexName`
4177

4278
> `string` | required
4379
80+
The index name.
81+
4482
#### `params`
4583

46-
> [`SearchParameters`](https://www.algolia.com/doc/api-reference/search-api-parameters/) & [`Request Options`](https://www.algolia.com/doc/api-client/getting-started/request-options/) | required
84+
> [`SearchForFacetValuesQueryParams` & `SearchOptions`](https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/#parameters)
85+
86+
Algolia search for facet values parameters.
87+
88+
These are the default parameters. You can leave them as is and specify other parameters, or override them.
89+
90+
:::info
91+
92+
If you override `highlightPreTag` and `highlightPostTag`, you won't be able to use the built-in highlighting utilities such as [`highlightHit`](highlightHit).
4793

48-
Default search parameters:
94+
:::
4995

5096
```json
5197
{
@@ -56,7 +102,7 @@ Default search parameters:
56102

57103
## Returns
58104

59-
It returns a promise of the following schema:
105+
The function returns a promise that resolves to a response with the following schema:
60106

61107
```json
62108
[
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Retrieves Algolia facet hits from multiple indices.
2+
3+
The `getAlgoliaFacetHits` function lets you query facet hits several Algolia indices at once.

0 commit comments

Comments
 (0)