Skip to content
Merged
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 @@ -41,6 +41,16 @@ compositionBehavior:
maxItems: 2
items:
$ref: '#/injectedItem'
deduplication:
title: deduplication
type: object
additionalProperties: false
description: Deduplication configures the methods used to resolve duplicate items between main search results and injected group results.
properties:
positioning:
$ref: '#/dedupPositioning'
required:
- positioning
required:
- main
required:
Expand Down Expand Up @@ -91,3 +101,17 @@ injectedItemSource:
oneOf:
- $ref: './InjectionSource.yml#/SearchSource'
- $ref: './InjectionSource.yml#/ExternalSource'

dedupPositioning:
type: string
enum:
- highest
- highestInjected
description: |
Deduplication positioning configures how a duplicate result should be resolved between an injected item and main search results.
Current configuration supports:
- 'highest': always select the item in the highest position, and remove duplicates that appear lower in the results.
- 'highestInjected': duplicate result will be moved to its highest possible injected position, but not higher.
If a duplicate appears higher in main search results, it will be removed to stay it's intended group position (which could be lower than main).
example: highest
default: highestInjected
89 changes: 83 additions & 6 deletions tests/CTS/requests/composition/multipleBatch.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@
}
},
{
"skipLanguages": [
"kotlin"
],
"skipLanguages": ["kotlin"],
"parameters": {
"requests": [
{
Expand Down Expand Up @@ -147,9 +145,7 @@
}
},
{
"skipLanguages": [
"kotlin"
],
"skipLanguages": ["kotlin"],
"parameters": {
"requests": [
{
Expand Down Expand Up @@ -312,5 +308,86 @@
]
}
}
},
{
"skipLanguages": ["kotlin"],
"parameters": {
"requests": [
{
"action": "upsert",
"body": {
"objectID": "my-compo",
"name": "my composition",
"behavior": {
"injection": {
"main": {
"source": {
"search": {
"index": "foo"
}
}
},
"injectedItems": [
{
"key": "my-unique-injected-item-key",
"source": {
"search": {
"index": "foo"
}
},
"position": 2,
"length": 1
}
],
"deduplication": {
"positioning": "highest"
}
}
}
}
}
]
},
"request": {
"path": "/1/compositions/*/batch",
"method": "POST",
"body": {
"requests": [
{
"action": "upsert",
"body": {
"objectID": "my-compo",
"name": "my composition",
"behavior": {
"injection": {
"main": {
"source": {
"search": {
"index": "foo"
}
}
},
"injectedItems": [
{
"key": "my-unique-injected-item-key",
"source": {
"search": {
"index": "foo"
}
},
"position": 2,
"length": 1
}
],
"deduplication": {
"positioning": "highest"
}
}
}
}
}
]
}
}
}
]
79 changes: 76 additions & 3 deletions tests/CTS/requests/composition/putComposition.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@
}
},
{
"skipLanguages": [
"kotlin"
],
"skipLanguages": ["kotlin"],
"parameters": {
"compositionID": "my-metadata-compo",
"composition": {
Expand Down Expand Up @@ -288,5 +286,80 @@
}
}
}
},
{
"parameters": {
"compositionID": "my-compo",
"composition": {
"objectID": "my-compo",
"name": "my composition",
"behavior": {
"injection": {
"main": {
"source": {
"search": {
"index": "foo",
"params": {
"filters": "brand:adidas"
}
}
}
},
"injectedItems": [
{
"key": "my-unique-injected-item-key",
"source": {
"search": {
"index": "foo"
}
},
"position": 2,
"length": 1
}
],
"deduplication": {
"positioning": "highest"
}
}
}
}
},
"request": {
"path": "/1/compositions/my-compo",
"method": "PUT",
"body": {
"objectID": "my-compo",
"name": "my composition",
"behavior": {
"injection": {
"main": {
"source": {
"search": {
"index": "foo",
"params": {
"filters": "brand:adidas"
}
}
}
},
"injectedItems": [
{
"key": "my-unique-injected-item-key",
"source": {
"search": {
"index": "foo"
}
},
"position": 2,
"length": 1
}
],
"deduplication": {
"positioning": "highest"
}
}
}
}
}
}
]
102 changes: 91 additions & 11 deletions tests/CTS/requests/composition/putCompositionRule.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@
}
},
{
"skipLanguages": [
"kotlin"
],
"skipLanguages": ["kotlin"],
"parameters": {
"compositionID": "compositionID",
"objectID": "rule-with-metadata",
Expand Down Expand Up @@ -197,10 +195,7 @@
"compositionRule": {
"objectID": "rule-with-exernal-source",
"description": "my description",
"tags": [
"tag1",
"tag2"
],
"tags": ["tag1", "tag2"],
"enabled": true,
"validity": [
{
Expand Down Expand Up @@ -258,10 +253,7 @@
"body": {
"objectID": "rule-with-exernal-source",
"description": "my description",
"tags": [
"tag1",
"tag2"
],
"tags": ["tag1", "tag2"],
"enabled": true,
"validity": [
{
Expand Down Expand Up @@ -313,5 +305,93 @@
}
}
}
},
{
"parameters": {
"compositionID": "compositionID",
"objectID": "rule-with-deduplication",
"compositionRule": {
"objectID": "rule-with-deduplication",
"description": "my description",
"enabled": true,
"conditions": [
{
"anchoring": "contains",
"pattern": "harry"
}
],
"consequence": {
"behavior": {
"injection": {
"main": {
"source": {
"search": {
"index": "my-index"
}
}
},
"injectedItems": [
{
"key": "my-unique-injected-item-key",
"source": {
"search": {
"index": "my-index"
}
},
"position": 0,
"length": 3
}
],
"deduplication": {
"positioning": "highestInjected"
}
}
}
}
}
},
"request": {
"path": "/1/compositions/compositionID/rules/rule-with-deduplication",
"method": "PUT",
"body": {
"objectID": "rule-with-deduplication",
"description": "my description",
"enabled": true,
"conditions": [
{
"anchoring": "contains",
"pattern": "harry"
}
],
"consequence": {
"behavior": {
"injection": {
"main": {
"source": {
"search": {
"index": "my-index"
}
}
},
"injectedItems": [
{
"key": "my-unique-injected-item-key",
"source": {
"search": {
"index": "my-index"
}
},
"position": 0,
"length": 3
}
],
"deduplication": {
"positioning": "highestInjected"
}
}
}
}
}
}
}
]
Loading