Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions specs/composition/paths/compositions/updateSortingStrategy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
post:
tags:
- Compositions
operationId: updateSortingStrategyComposition
x-acl:
- editSettings
summary: Set or update the "sortingStrategy" configuration for an existing composition
description: |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we put a warning that we can't check that the sorting strategy is valid in this endpoint ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good idea, added warning

Updates the "sortingStrategy" field of an existing composition.
This endpoint allows you to create a new sorting strategy mapping or replace the currently configured one.
The provided sorting indices MUST be associated indices or replicas of the main targeted index.

WARNING: This endpoint cannot validate if the sort index is related to the composition's main index.
Validation will fail at runtime if the index you updated is not related!

The update is applied to the specified composition within the current Algolia application and returns a taskID that can be used to track the operation’s completion.
parameters:
- $ref: '../urlParams.yml#/compositionID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../common/schemas/components/Composition.yml#/sortingStrategy'
responses:
'200':
description: OK
content:
application/json:
schema:
title: taskIDResponse
type: object
additionalProperties: false
properties:
taskID:
$ref: '../../../common/responses/common.yml#/taskID'
required:
- taskID
'400':
$ref: '../../../common/responses/BadRequest.yml'
'402':
$ref: '../../../common/responses/FeatureNotEnabled.yml'
'403':
$ref: '../../../common/responses/MethodNotAllowed.yml'
'404':
$ref: '../../../common/responses/CompositionNotFound.yml'
2 changes: 2 additions & 0 deletions specs/composition/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ paths:
$ref: 'paths/compositions/composition.yml'
/1/compositions/*/batch:
$ref: 'paths/compositions/batch.yml'
/1/compositions/{compositionID}/sortingStrategy:
$ref: 'paths/compositions/updateSortingStrategy.yml'

# ##########################################
# ### Manage Composition Rules Endpoints ###
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
{
"parameters": {
"compositionID": "my-compo",
"requestBody": {
"Price-asc": "products-low-to-high",
"Price-desc": "products-high-to-low"
}
},
"request": {
"path": "/1/compositions/my-compo/sortingStrategy",
"method": "POST",
"body": {
"Price-asc": "products-low-to-high",
"Price-desc": "products-high-to-low"
}
}
}
]