You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 21, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: open-api.yaml
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -606,6 +606,12 @@ components:
606
606
type: integer
607
607
default: 100
608
608
nullable: false
609
+
sortFacetValuesBy:
610
+
description: Defines how facet values are sorted. By default, all facets (`*`) are sorted by name, alphanumerically in ascending order (`alpha`). `count` sorts facet values by the number of documents containing a facet value in descending order.
611
+
type: object
612
+
example:
613
+
"*": 'alpha'
614
+
"genres": 'count'
609
615
filterableAttributes:
610
616
type: array
611
617
description: |
@@ -2401,6 +2407,8 @@ paths:
2401
2407
maxTotalHits: 1000
2402
2408
faceting:
2403
2409
maxValuesPerFacet: 100
2410
+
sortFacetValuesBy:
2411
+
"*": "alpha"
2404
2412
'401':
2405
2413
$ref: '#/components/responses/401'
2406
2414
'404':
@@ -2500,6 +2508,8 @@ paths:
2500
2508
maxTotalHits: 1000
2501
2509
faceting:
2502
2510
maxValuesPerFacet: 100
2511
+
sortFacetValuesBy:
2512
+
"*": "alpha"
2503
2513
responses:
2504
2514
'202':
2505
2515
description: Accepted
@@ -3077,7 +3087,7 @@ paths:
3077
3087
operationId: indexes.settings.faceting.update
3078
3088
summary: Update faceting settings
3079
3089
description: |
3080
-
Update the typo tolerance faceting of an index.
3090
+
Update the faceting settings of an index.
3081
3091
3082
3092
> info
3083
3093
> If the provided index does not exist, it will be created.
Copy file name to clipboardExpand all lines: text/0034-telemetry-policies.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -158,6 +158,8 @@ The collected data is sent to [Segment](https://segment.com/). Segment is a plat
158
158
|`typo_tolerance.min_word_size_for_typos.two_typos`| The defined value for `minWordSizeForTypos.twoTypos` property |`9`|`Settings Updated`, `TypoTolerance Updated`|
159
159
|`pagination.max_total_hits`| The defined value for `pagination.maxTotalHits` property |`1000`|`Settings Updated`, `Pagination Updated`|
160
160
|`faceting.max_values_per_facet`| The defined value for `faceting.maxValuesPerFacet` property |`100`|`Settings Updated`, `Faceting Updated`|
161
+
|`faceting.sort_facet_values_by_star_count`| Whether the user set all fields to be sort by count |`true`|`Settings Updated`, `Faceting Updated`|
162
+
|`faceting.sort_facet_values_by_total`| The number of different values that were set |`10`|`Settings Updated`, `Faceting Updated`|
161
163
|`distinct_attribute.set`|`true` if a field name is specified as a distrinct attribute, otherwise `false`. |`false`|`Settings Updated`, `DistinctAttribute Updated`|
162
164
|`displayed_attributes.total`| Number of displayed attributes. |`3`|`SettingUpdated`, `DisplayedAttributes Updated`|
163
165
|`displayed_attributes.with_wildcard`|`true` if `*` is specified as a displayed attribute, otherwise `false`. |`false`|`SettingUpdated`, `DisplayedAttributes Updated`|
@@ -467,6 +469,8 @@ This property allows us to gather essential information to better understand on
467
469
| typo_tolerance.min_word_size_for_typos.two_typos | The defined value for `minWordSizeForTypos.twoTypos` property. |`9`|
468
470
| pagination.max_total_hits | The defined value for `pagination.maxTotalHits` property |`1000`|
469
471
| faceting.max_values_per_facet | The defined value for `faceting.maxValuesPerFacet` property |`100`|
472
+
| faceting.sort_facet_values_by_star_count | Whether the user set all fields to be sort by count |`true`|
473
+
| faceting.sort_facet_values_by_total | The number of different values that were set |`10`|
470
474
| distinct_attribute.set |`true` if a field name is specified, otherwise `false`. |`false`|
471
475
| displayed_attributes.total | Number of displayed attributes. |`3`|
472
476
| displayed_attributes.with_wildcard |`true` if `*` is specified as a displayed attribute, otherwise `false`. |`false`|
@@ -540,6 +544,8 @@ This property allows us to gather essential information to better understand on
540
544
|---------------|-------------|---------|
541
545
| user_agent | Represents the user-agent encountered on this call. |`["Meilisearch Ruby (v2.1)", "Ruby (3.0)"]`|
542
546
| faceting.max_values_per_facet | The defined value for `maxValuesPerFacet` property |`100`|
547
+
| faceting.sort_facet_values_by_star_count | Whether the user set all fields to be sort by count |`true`|
548
+
| faceting.sort_facet_values_by_total | The number of different values that were set |`10`|
@@ -34,6 +35,33 @@ Increasing this value can degrade performance as well as expose the data of an i
34
35
35
36
The facets that are returned are sorted in ascending lexicographical order.
36
37
38
+
#### 3.1.2 `sortFacetValuesBy`
39
+
40
+
- Type: Object
41
+
- Required: False
42
+
- Default:
43
+
44
+
```json
45
+
{
46
+
"*": "alpha"
47
+
}
48
+
```
49
+
50
+
Defines how facet values are sorted. By default, all facets (`*`) are sorted by name, alphanumerically in ascending order (`alpha`).
51
+
52
+
It is possible to sort them by the number of documents containing a facet value in descending order using `count`.
53
+
54
+
It is possible to specify a particular order for a facet.
55
+
56
+
```json
57
+
{
58
+
"*": "alpha",
59
+
"genre": "count"
60
+
}
61
+
```
62
+
63
+
In this example, values from facets other than `genres` will be displayed sorted by their name in ascending alphanumeric order, while values from the `genres` facet will be sorted in descending order by the count of the number of documents containing each value.
64
+
37
65
## 3.2. API Endpoints Definition
38
66
39
67
### 3.2.1. Global Settings API Endpoints Definition
@@ -54,7 +82,10 @@ Allow fetching the current definition of the faceting setting for an index.
54
82
55
83
```json
56
84
{
57
-
"maxValuesPerFacet": 100
85
+
"maxValuesPerFacet": 100,
86
+
"sortFacetValuesBy": {
87
+
"*": "alpha"
88
+
}
58
89
}
59
90
```
60
91
@@ -103,8 +134,8 @@ See [Summarized `task` Object for `202 Accepted`](0060-tasks-api.md#summarized-t
103
134
- 🔴 Sending an empty payload returns a [missing_payload](0061-error-format-and-definitions.md#missing_payload) error.
104
135
- 🔴 Sending an invalid JSON payload returns a [malformed_payload](0061-error-format-and-definitions.md#malformed_payload) error.
105
136
- 🔴 Sending an invalid index uid format for the `:index_uid` path parameter returns an [invalid_index_uid](0061-error-format-and-definitions.md#invalid_index_uid) error.
106
-
- 🔴 Sending a value different from `null` or with a different type than `Integer` for the `maxValuesPerFacet` field returns
107
-
an [invalid_settings_faceting](0061-error-format-and-definitions.md#invalid_settings_faceting) error.
137
+
- 🔴 Sending a value different from `null` or with a different type than `Integer` for the `maxValuesPerFacet` field returns an [invalid_settings_faceting](0061-error-format-and-definitions.md#invalid_settings_faceting) error.
138
+
- 🔴 Sending a value different from `null` or an object with value with a different type than `"alpha"` or `"count"` for the `sortFacetValuesBy` field returns an [invalid_settings_faceting](0061-error-format-and-definitions.md#invalid_settings_faceting) error.
108
139
109
140
###### 3.2.2.2.2.1. Async Errors
110
141
@@ -149,5 +180,4 @@ The auth layer can return the following errors if Meilisearch is secured (a mast
149
180
n/a
150
181
151
182
## 3. Future Possibilities
152
-
153
-
- Introduces a field to define the sorting of facets. e.g `sort` by `count`/`alphanumeric`
0 commit comments