Skip to content

Commit 5f01361

Browse files
committed
add new endpoint for updating sortingStrategy
1 parent df2bc07 commit 5f01361

File tree

3 files changed

+59
-15
lines changed

3 files changed

+59
-15
lines changed

specs/composition/common/schemas/components/Composition.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,26 @@ composition:
1515
behavior:
1616
$ref: './CompositionBehavior.yml#/compositionBehavior'
1717
sortingStrategy:
18-
type: object
19-
description: |
20-
A mapping of sorting labels to the indices (or replicas) that implement those sorting rules.
18+
$ref: '#/sortingStrategy'
2119

22-
Each key is the label your frontend sends at runtime (for example, "Price (asc)"), and each value is the name of the index that should be queried when that label is selected.
23-
When a request includes a "sortBy" parameter, the platform looks up the corresponding index in this mapping and uses it to execute the query. The main injection targeted index is replaced
24-
with the sorting strategy index it is mapped to.
25-
26-
Up to 20 sorting strategies can be defined.
27-
maxItems: 20
28-
additionalProperties:
29-
type: string
30-
example:
31-
'Price (asc)': 'products-low-to-high'
32-
'Price (desc)': 'products-high-to-low'
33-
3420
required:
3521
- objectID
3622
- behavior
3723
- name
24+
25+
sortingStrategy:
26+
type: object
27+
description: |
28+
A mapping of sorting labels to the indices (or replicas) that implement those sorting rules.
29+
30+
Each key is the label your frontend sends at runtime (for example, "Price (asc)"), and each value is the name of the index that should be queried when that label is selected.
31+
When a request includes a "sortBy" parameter, the platform looks up the corresponding index in this mapping and uses it to execute the query. The main injection targeted index is replaced
32+
with the sorting strategy index it is mapped to.
33+
34+
Up to 20 sorting strategies can be defined.
35+
maxItems: 20
36+
additionalProperties:
37+
type: string
38+
example:
39+
'Price (asc)': 'products-low-to-high'
40+
'Price (desc)': 'products-high-to-low'
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
post:
2+
tags:
3+
- Compositions
4+
operationId: updateCompositionSortingStrategy
5+
x-acl:
6+
- editSettings
7+
summary: Update sortingStrategy for an existing composition
8+
description: |
9+
Update Update sortingStrategy for an existing composition in the current Algolia application.
10+
parameters:
11+
- $ref: '../urlParams.yml#/compositionID'
12+
requestBody:
13+
required: true
14+
content:
15+
application/json:
16+
schema:
17+
$ref: '../../common/schemas/components/Composition.yml#/sortingStrategy'
18+
responses:
19+
'200':
20+
description: OK
21+
content:
22+
application/json:
23+
schema:
24+
title: taskIDResponse
25+
type: object
26+
additionalProperties: false
27+
properties:
28+
taskID:
29+
$ref: '../../../common/responses/common.yml#/taskID'
30+
required:
31+
- taskID
32+
'400':
33+
$ref: '../../../common/responses/BadRequest.yml'
34+
'402':
35+
$ref: '../../../common/responses/FeatureNotEnabled.yml'
36+
'403':
37+
$ref: '../../../common/responses/MethodNotAllowed.yml'
38+
'404':
39+
$ref: '../../../common/responses/CompositionNotFound.yml'

specs/composition/spec.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ paths:
139139
$ref: 'paths/compositions/composition.yml'
140140
/1/compositions/*/batch:
141141
$ref: 'paths/compositions/batch.yml'
142+
/1/compositions/{compositionID}/sortingStrategy:
143+
$ref: 'paths/compositions/updateSortingStrategy.yml'
142144

143145
# ##########################################
144146
# ### Manage Composition Rules Endpoints ###

0 commit comments

Comments
 (0)