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
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ injectedItemSource:
oneOf:
- $ref: './InjectedItemSource.yml#/SearchSource'
- $ref: './InjectedItemSource.yml#/ExternalSource'
- $ref: './InjectedItemSource.yml#/RecommendSource'

dedupPositioning:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,38 @@ ExternalSource:
externalOrdering:
enum: ['default', 'userDefined']
default: 'default'

RecommendSource:
title: recommendSource
description: Injected items will originate from a recommendation request performed on the specified index.
x-discriminator-fields:
- recommend
type: object
additionalProperties: false
properties:
recommend:
title: recommend
type: object
additionalProperties: false
properties:
indexName:
type: string
description: Index to retrieve recommendations from.
example: Products
model:
$ref: './RecommendModel.yml#/model'
threshold:
type: integer
minimum: 0
maximum: 100
description: Minimum score a recommendation must have to be included.
queryParameters:
$ref: './SearchQueryParams.yml#/injectedItemsQueryParameters'
fallbackParameters:
$ref: './SearchQueryParams.yml#/injectedItemsQueryParameters'
required:
- indexName
- model
- threshold
required:
- recommend
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SearchSource:
properties:
index:
type: string
description: Composition Index name.
description: Index to retrieve search results from.
example: Products
params:
$ref: './SearchQueryParams.yml#/mainInjectionQueryParameters'
Expand All @@ -33,11 +33,24 @@ RecommendSource:
type: object
additionalProperties: false
properties:
index:
indexName:
type: string
description: Composition Index name.
description: Index to retrieve recommendations from.
example: Products
model:
$ref: './RecommendModel.yml#/model'
threshold:
type: integer
minimum: 0
maximum: 100
description: Minimum score a recommendation must have to be included.
queryParameters:
$ref: './SearchQueryParams.yml#/mainInjectionQueryParameters'
fallbackParameters:
$ref: './SearchQueryParams.yml#/mainInjectionQueryParameters'
required:
- index
- indexName
- model
- threshold
required:
- recommend
- recommend
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
model:
type: string
enum:
- trending-items
description: Recommendation model to use for retrieving recommendations.
example: trending-items
150 changes: 150 additions & 0 deletions tests/CTS/requests/composition/putComposition.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,156 @@
}
}
},
{
"parameters": {
"compositionID": "my-recommend-compo",
"composition": {
"objectID": "my-recommend-compo",
"name": "my recommend composition",
"behavior": {
"injection": {
"main": {
"source": {
"recommend": {
"indexName": "products",
"model": "trending-items",
"threshold": 50
}
}
},
"injectedItems": [
{
"key": "injected-recommend-key",
"source": {
"recommend": {
"indexName": "products",
"model": "trending-items",
"threshold": 30,
"fallbackParameters": {
"filters": "category:electronics"
}
}
},
"position": 3,
"length": 2
}
]
}
}
}
},
"request": {
"path": "/1/compositions/my-recommend-compo",
"method": "PUT",
"body": {
"objectID": "my-recommend-compo",
"name": "my recommend composition",
"behavior": {
"injection": {
"main": {
"source": {
"recommend": {
"indexName": "products",
"model": "trending-items",
"threshold": 50
}
}
},
"injectedItems": [
{
"key": "injected-recommend-key",
"source": {
"recommend": {
"indexName": "products",
"model": "trending-items",
"threshold": 30,
"fallbackParameters": {
"filters": "category:electronics"
}
}
},
"position": 3,
"length": 2
}
]
}
}
}
}
},
{
"parameters": {
"compositionID": "my-search-and-recommend-compo",
"composition": {
"objectID": "my-search-and-recommend-compo",
"name": "my search main with recommend injection",
"behavior": {
"injection": {
"main": {
"source": {
"search": {
"index": "products",
"params": {
"filters": "brand:nike"
}
}
}
},
"injectedItems": [
{
"key": "injected-recommend-key",
"source": {
"recommend": {
"indexName": "products",
"model": "trending-items",
"threshold": 40
}
},
"position": 1,
"length": 3
}
]
}
}
}
},
"request": {
"path": "/1/compositions/my-search-and-recommend-compo",
"method": "PUT",
"body": {
"objectID": "my-search-and-recommend-compo",
"name": "my search main with recommend injection",
"behavior": {
"injection": {
"main": {
"source": {
"search": {
"index": "products",
"params": {
"filters": "brand:nike"
}
}
}
},
"injectedItems": [
{
"key": "injected-recommend-key",
"source": {
"recommend": {
"indexName": "products",
"model": "trending-items",
"threshold": 40
}
},
"position": 1,
"length": 3
}
]
}
}
}
}
},
{
"parameters": {
"compositionID": "my-compo",
Expand Down
Loading
Loading