Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit 63429e0

Browse files
gmourierKerollmops
andauthored
Settings API - Customize the hard limits for pagination and faceting (#157)
* Introduces specification files * Update files name * branch telemetry * Update open-api.yml * Update text/0034-telemetry-policies.md Co-authored-by: Clément Renault <[email protected]> * update open-api.yml * Update text/157-faceting-setting-api.md Co-authored-by: Clément Renault <[email protected]> * Rename limitedTo to maxTotalHits * Specify order of returned facet Co-authored-by: Clément Renault <[email protected]>
1 parent 4b278e8 commit 63429e0

File tree

5 files changed

+494
-4
lines changed

5 files changed

+494
-4
lines changed

open-api.yaml

Lines changed: 173 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,10 +450,28 @@ components:
450450
type: integer
451451
default: 9
452452
nullable: false
453+
pagination:
454+
type: object
455+
description: Customize pagination settings
456+
properties:
457+
maxTotalHits:
458+
description: Define the maximum number of documents reachable for a search request. It means that with the default value of `1000`, it is not possible to see the `1001`st result for a **search query**.
459+
type: integer
460+
default: 1000
461+
nullable: false
462+
faceting:
463+
type: object
464+
description: Customize faceting settings
465+
properties:
466+
maxValuesPerFacet:
467+
description: Define maximum number of value returned for a facet for a **search query**. It means that with the default value of `100`, it is not possible to have `101` different colors if the `color`` field is defined as a facet at search time.
468+
type: integer
469+
default: 100
470+
nullable: false
453471
filterableAttributes:
454472
type: array
455473
description: |
456-
Attributes to use for facetting and filtering. See [Filtering and Faceted Search](https://docs.meilisearch.com/reference/features/filtering_and_faceted_search.html).
474+
Attributes to use for faceting and filtering. See [Filtering and Faceted Search](https://docs.meilisearch.com/reference/features/filtering_and_faceted_search.html).
457475
items:
458476
type: string
459477
example:
@@ -1723,6 +1741,10 @@ paths:
17231741
$ref: '#/components/schemas/sortableAttributes'
17241742
typoTolerance:
17251743
$ref: '#/components/schemas/typoTolerance'
1744+
pagination:
1745+
$ref: '#/components/schemas/pagination'
1746+
faceting:
1747+
$ref: '#/components/schemas/faceting'
17261748
required:
17271749
- rankingRules
17281750
- distinctAttribute
@@ -1733,6 +1755,8 @@ paths:
17331755
- filterableAttributes
17341756
- sortableAttributes
17351757
- typoTolerance
1758+
- pagination
1759+
- faceting
17361760
examples:
17371761
Example:
17381762
value:
@@ -1784,6 +1808,10 @@ paths:
17841808
minWordSizeForTypos:
17851809
oneTypo: 4
17861810
twoTypos: 8
1811+
pagination:
1812+
maxTotalHits: 1000
1813+
faceting:
1814+
maxValuesPerFacet: 100
17871815
'401':
17881816
$ref: '#/components/responses/401'
17891817
'404':
@@ -1829,6 +1857,10 @@ paths:
18291857
$ref: '#/components/schemas/sortableAttributes'
18301858
typoTolerance:
18311859
$ref: '#/components/schemas/typoTolerance'
1860+
pagination:
1861+
$ref: '#/components/schemas/pagination'
1862+
faceting:
1863+
$ref: '#/components/schemas/faceting'
18321864
examples:
18331865
Example:
18341866
value:
@@ -1875,6 +1907,10 @@ paths:
18751907
minWordSizeForTypos:
18761908
oneTypo: 4
18771909
twoTypos: 8
1910+
pagination:
1911+
maxTotalHits: 1000
1912+
faceting:
1913+
maxValuesPerFacet: 100
18781914
responses:
18791915
'202':
18801916
$ref: '#/components/responses/202'
@@ -2261,6 +2297,142 @@ paths:
22612297
description: Not Found
22622298
parameters:
22632299
- $ref: '#/components/parameters/indexUid'
2300+
'/indexes/{indexUid}/settings/pagination':
2301+
get:
2302+
operationId: indexes.settings.pagination.get
2303+
summary: Get pagination configuration
2304+
description: |
2305+
Get the pagination configuration of an index.
2306+
tags:
2307+
- Settings
2308+
security:
2309+
- apiKey: []
2310+
responses:
2311+
'200':
2312+
description: Ok
2313+
content:
2314+
application/json:
2315+
schema:
2316+
$ref: '#/components/schemas/pagination'
2317+
'401':
2318+
$ref: '#/components/responses/401'
2319+
'404':
2320+
description: Not Found
2321+
patch:
2322+
operationId: indexes.settings.pagination.update
2323+
summary: Update pagination settings
2324+
description: |
2325+
Update the pagination configuration of an index.
2326+
2327+
> info
2328+
> If the provided index does not exist, it will be created.
2329+
tags:
2330+
- Settings
2331+
security:
2332+
- apiKey: []
2333+
requestBody:
2334+
required: true
2335+
content:
2336+
application/json:
2337+
schema:
2338+
$ref: '#/components/schemas/pagination'
2339+
examples: {}
2340+
description: ''
2341+
responses:
2342+
'202':
2343+
$ref: '#/components/responses/202'
2344+
'401':
2345+
$ref: '#/components/responses/401'
2346+
'404':
2347+
description: Not Found
2348+
parameters:
2349+
- $ref: '#/components/parameters/Content-Type'
2350+
delete:
2351+
operationId: indexes.settings.pagination.reset
2352+
summary: Reset pagination settings to the default configuration
2353+
description: |
2354+
Reset the pagination settings of an index to its default configuration.
2355+
tags:
2356+
- Settings
2357+
security:
2358+
- apiKey: []
2359+
responses:
2360+
'202':
2361+
$ref: '#/components/responses/202'
2362+
'401':
2363+
$ref: '#/components/responses/401'
2364+
'404':
2365+
description: Not Found
2366+
parameters:
2367+
- $ref: '#/components/parameters/indexUid'
2368+
'/indexes/{indexUid}/settings/faceting':
2369+
get:
2370+
operationId: indexes.settings.faceting.get
2371+
summary: Get faceting configuration
2372+
description: |
2373+
Get the faceting configuration of an index.
2374+
tags:
2375+
- Settings
2376+
security:
2377+
- apiKey: []
2378+
responses:
2379+
'200':
2380+
description: Ok
2381+
content:
2382+
application/json:
2383+
schema:
2384+
$ref: '#/components/schemas/faceting'
2385+
'401':
2386+
$ref: '#/components/responses/401'
2387+
'404':
2388+
description: Not Found
2389+
patch:
2390+
operationId: indexes.settings.faceting.update
2391+
summary: Update faceting settings
2392+
description: |
2393+
Update the typo tolerance faceting of an index.
2394+
2395+
> info
2396+
> If the provided index does not exist, it will be created.
2397+
tags:
2398+
- Settings
2399+
security:
2400+
- apiKey: []
2401+
requestBody:
2402+
required: true
2403+
content:
2404+
application/json:
2405+
schema:
2406+
$ref: '#/components/schemas/faceting'
2407+
examples: {}
2408+
description: ''
2409+
responses:
2410+
'202':
2411+
$ref: '#/components/responses/202'
2412+
'401':
2413+
$ref: '#/components/responses/401'
2414+
'404':
2415+
description: Not Found
2416+
parameters:
2417+
- $ref: '#/components/parameters/Content-Type'
2418+
delete:
2419+
operationId: indexes.settings.faceting.reset
2420+
summary: Reset faceting settings to the default configuration
2421+
description: |
2422+
Reset the faceting settings of an index to its default configuration.
2423+
tags:
2424+
- Settings
2425+
security:
2426+
- apiKey: []
2427+
responses:
2428+
'202':
2429+
$ref: '#/components/responses/202'
2430+
'401':
2431+
$ref: '#/components/responses/401'
2432+
'404':
2433+
description: Not Found
2434+
parameters:
2435+
- $ref: '#/components/parameters/indexUid'
22642436
'/indexes/{indexUid}/settings/filterable-attributes':
22652437
get:
22662438
operationId: indexes.settings.filterableAttributes.get

text/0034-telemetry-policies.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ The collected data is sent to [Segment](https://segment.com/). Segment is a plat
5454
| FilterableAttributes Updated | Occurs when filterable attributes are updated via `POST` - `/indexes/:indexUid/settings/filterable-attributes`. |
5555
| SortableAttributes Updated | Occurs when sortable attributes are updated via `POST` - `/indexes/:indexUid/settings/sortable-attributes`. |
5656
| TypoTolerance Updated | Occurs when typo tolerance settings are updated via `POST` - `/indexes/:indexUid/settings/typo-tolerance`. |
57+
| Pagination Updated | Occurs when pagination settings are updated via `PATCH``/indexes/:indexUid/settings/pagination`. |
58+
| Faceting Updated | Occurs when faceting settings are updated via `PATCH``/indexes/:indexUid/settings/faceting`. |
5759
| Dump Created | Occurs when a dump is created via `POST` - `/dumps`. |
5860
| Tasks Seen | Occurs when tasks are fetched globally via `GET` - `/tasks`. |
5961

@@ -128,6 +130,8 @@ The collected data is sent to [Segment](https://segment.com/). Segment is a plat
128130
| `typo_tolerance.disable_on_words` | `true` if at least one value is defined | `false` | `Settings Updated`, `TypoTolerance Updated` |
129131
| `typo_tolerance.min_word_size_for_typos.one_typo` | The defined value for `minWordSizeForTypos.oneTypo` property | `5` | `Settings Updated`, `TypoTolerance Updated` |
130132
| `typo_tolerance.min_word_size_for_typos.two_typos`| The defined value for `minWordSizeForTypos.twoTypos` property | `9` | `Settings Updated`, `TypoTolerance Updated` |
133+
| `pagination.max_total_hits` | The defined value for `pagination.maxTotalHits` property | `1000` | `Settings Updated`, `Pagination Updated` |
134+
| `faceting.max_values_per_facet` | The defined value for `faceting.maxValuesPerFacet` property | `100` | `Settings Updated`, `Faceting Updated` |
131135
| `per_task_uid` | `true` if an uid is used to fetch a particular task resource, otherwise `false` | true | `Tasks Seen` |
132136
| `filtered_by_index_uid` | `true` if `GET /tasks` endpoint is filered by `indexUid`, otherwise `false` | false | `Tasks Seen` |
133137
| `filtered_by_type` | `true` if `GET /tasks` endpoint is filered by `type`, otherwise `false` | false | `Tasks Seen` |
@@ -311,6 +315,8 @@ This property allows us to gather essential information to better understand on
311315
| typo_tolerance.disable_on_words | `true` if at least one value is defined for `disableOnWords` property. | `false` |
312316
| typo_tolerance.min_word_size_for_typos.one_typo | The defined value for `minWordSizeForTypos.oneTypo` property. | `5` |
313317
| typo_tolerance.min_word_size_for_typos.two_typos | The defined value for `minWordSizeForTypos.twoTypos` property. | `9` |
318+
| pagination.max_total_hits | The defined value for `pagination.maxTotalHits` property | `1000` |
319+
| faceting.max_values_per_facet | The defined value for `faceting.maxValuesPerFacet` property | `100` |
314320

315321
---
316322

@@ -352,12 +358,24 @@ This property allows us to gather essential information to better understand on
352358

353359
| Property name | Description | Example |
354360
|---------------|-------------|---------|
355-
| typo_tolerance.enabled | Whether the typo tolerance is enable.d | `true` |
361+
| typo_tolerance.enabled | Whether the typo tolerance is enabled | `true` |
356362
| typo_tolerance.disable_on_attributes | `true` if at least one value is defined for `disableOnAttributes` property. | `false` |
357363
| typo_tolerance.disable_on_words | `true` if at least one value is defined for `disableOnWords` property. | `false` |
358364
| typo_tolerance.min_word_size_for_typos.one_typo | The defined value for `minWordSizeForTypos.oneTypo` property. | `5` |
359365
| typo_tolerance.min_word_size_for_typos.two_typos | The defined value for `minWordSizeForTypos.twoTypos` property. | `9` |
360366

367+
## `Pagination Updated`
368+
369+
| Property name | Description | Example |
370+
|---------------|-------------|---------|
371+
| pagination.max_total_hits | The defined value for `maxTotalHits` property | `1000` |
372+
373+
## `Faceting Updated`
374+
375+
| Property name | Description | Example |
376+
|---------------|-------------|---------|
377+
| faceting.max_values_per_facet | The defined value for `maxValuesPerFacet` property | `100` |
378+
361379
## `Dump Created`
362380

363381
| Property name | Description | Example |

text/0123-settings-api.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ N/A
2222
| [synonyms](0123-synonyms-setting-api.md) | `synonyms` sub-resource API endpoints definition |
2323
| [distinct-attribute](0123-distinct-attribute-setting-api.md) | `distinctAttribute` sub-resource API endpoints definition |
2424
| [typo-tolerance](0117-typo-tolerance-setting-api.md) | `typoTolerance` sub-resource API endpoints definition |
25+
| [pagination](157-pagination-setting-api.md) | `pagination` sub-resource API endpoints definition |
26+
| [faceting](157-faceting-setting-api.md) | `faceting` sub-resource API endpoints definition |
2527

2628
Each setting is exposed as a sub-resource of the `indexes/:index_uid/settings` endpoints. e.g. The ranking rules setting of a Meilisearch index is exposed at `indexes/:index_uid/settings/ranking-rules`.
2729

@@ -47,7 +49,9 @@ Fetch the settings of a Meilisearch index.
4749
| `stopWords` | Array of String | true |
4850
| `synonyms` | Object | true |
4951
| `distinctAttribute` | String / `null` | true |
50-
| `typo` | Object | true |
52+
| `typoTolerance` | Object | true |
53+
| `pagination` | Object | true |
54+
| `faceting` | Object | true |
5155

5256
The attributes ordering in the response payload is equivalent to the order described in the table above.
5357

@@ -71,7 +75,9 @@ Modify the settings of a Meilisearch index.
7175
| `stopWords` | Array of String / `null` | false |
7276
| `synonyms` | Object / `null` | false |
7377
| `distinctAttribute` | String / `null` | false |
74-
| `typo` | Object | false |
78+
| `typoTolerance` | Object | false |
79+
| `pagination` | Object | false |
80+
| `faceting` | Object | false |
7581

7682
The request payload accepts partial definitions.
7783

0 commit comments

Comments
 (0)