File tree Expand file tree Collapse file tree 6 files changed +218
-21
lines changed
specs/composition-full/common
tests/CTS/requests/composition-full Expand file tree Collapse file tree 6 files changed +218
-21
lines changed Original file line number Diff line number Diff line change @@ -26,4 +26,42 @@ ruleContexts:
26
26
default : []
27
27
example : [mobile]
28
28
x-categories :
29
- - Rules
29
+ - Rules
30
+
31
+ injectedItems :
32
+ type : object
33
+ additionalProperties :
34
+ $ref : ' #/externalInjectedItem'
35
+ description : |
36
+ A list of extenrally injected objectID groups into from an external source.
37
+ default : {}
38
+ x-categories :
39
+ - Advanced
40
+
41
+ externalInjectedItem :
42
+ type : object
43
+ properties :
44
+ items :
45
+ type : array
46
+ items :
47
+ title : externalInjection
48
+ type : object
49
+ additionalProperties : false
50
+ properties :
51
+ objectID :
52
+ type : string
53
+ description : An objectID injected into an external source.
54
+ metadata :
55
+ type : object
56
+ additionalProperties : true
57
+ description : |
58
+ User-defined key-values that will be added to the injected item in the response.
59
+ This is identical to Hits metadata defined in Composition or Composition Rule,
60
+ with the benefit of being set at runtime.
61
+ example : {'my-field': 'my-value'}
62
+ required :
63
+ - objectID
64
+ example :
65
+ {'objectID': 'my-object-1', 'metadata': {'my-field': 'my-value'}}
66
+ required :
67
+ - items
Original file line number Diff line number Diff line change @@ -54,25 +54,8 @@ injectedItem:
54
54
type : string
55
55
description : injected Item unique identifier.
56
56
source :
57
- title : injectedItemSource
58
- type : object
59
- additionalProperties : false
60
- properties :
61
- search :
62
- title : injectedItemSourceSearch
63
- type : object
64
- additionalProperties : false
65
- properties :
66
- index :
67
- type : string
68
- description : Composition Main Index name.
69
- example : Products
70
- params :
71
- $ref : ' ./Injection.yml#/injectedItemsQueryParameters'
72
- required :
73
- - index
74
- required :
75
- - search
57
+ description : Search source to be used to inject items into result set.
58
+ $ref : ' #/injectedItemSource'
76
59
position :
77
60
type : integer
78
61
minimum : 0
@@ -103,3 +86,8 @@ injectedItem:
103
86
- source
104
87
- position
105
88
- length
89
+
90
+ injectedItemSource :
91
+ oneOf :
92
+ - $ref : ' ./InjectionSource.yml#/SearchSource'
93
+ - $ref : ' ./InjectionSource.yml#/ExternalSource'
Original file line number Diff line number Diff line change
1
+ SearchSource :
2
+ title : searchSource
3
+ description : Injected items will originate from a search request performed on the specified index.
4
+ type : object
5
+ additionalProperties : false
6
+ properties :
7
+ search :
8
+ title : search
9
+ type : object
10
+ additionalProperties : false
11
+ properties :
12
+ index :
13
+ type : string
14
+ description : Composition Index name.
15
+ example : Products
16
+ params :
17
+ $ref : ' ./Injection.yml#/injectedItemsQueryParameters'
18
+ required :
19
+ - index
20
+ required :
21
+ - search
22
+
23
+ ExternalSource :
24
+ title : externalSource
25
+ description : Injected items will originate from externally provided objectIDs (that must exist in the index) given at runtime in the run request payload.
26
+ type : object
27
+ additionalProperties : false
28
+ properties :
29
+ external :
30
+ title : external
31
+ type : object
32
+ additionalProperties : false
33
+ properties :
34
+ index :
35
+ type : string
36
+ description : Composition Index name.
37
+ example : Products
38
+ params :
39
+ $ref : ' ./Injection.yml#/injectedItemsQueryParameters'
40
+ ordering :
41
+ $ref : ' #/externalOrdering'
42
+ required :
43
+ - index
44
+ required :
45
+ - external
46
+
47
+ externalOrdering :
48
+ enum : ['default', 'userDefined']
49
+ default : ' default'
Original file line number Diff line number Diff line change @@ -54,4 +54,6 @@ params:
54
54
enableABTest :
55
55
$ref : ' ../../params/Composition.yml#/enableABTest'
56
56
enableReRanking :
57
- $ref : ' ../../params/Search.yml#/enableReRanking'
57
+ $ref : ' ../../params/Search.yml#/enableReRanking'
58
+ injectedItems :
59
+ $ref : ' ../../params/Composition.yml#/injectedItems'
Original file line number Diff line number Diff line change 61
61
}
62
62
}
63
63
}
64
+ },
65
+ {
66
+ "parameters" : {
67
+ "compositionID" : " my-external-injection-compo" ,
68
+ "composition" : {
69
+ "objectID" : " my-external-injection-compo" ,
70
+ "name" : " my first composition" ,
71
+ "behavior" : {
72
+ "injection" : {
73
+ "main" : {
74
+ "source" : {
75
+ "search" : {
76
+ "index" : " foo"
77
+ }
78
+ }
79
+ },
80
+ "injectedItems" : [
81
+ {
82
+ "key" : " injectedItem1" ,
83
+ "source" : {
84
+ "external" : {
85
+ "index" : " foo" ,
86
+ "ordering" : " userDefined" ,
87
+ "params" : {
88
+ "filters" : " brand:adidas"
89
+ }
90
+ }
91
+ },
92
+ "position" : 2 ,
93
+ "length" : 1
94
+ }
95
+ ]
96
+ }
97
+ }
98
+ }
99
+ },
100
+ "request" : {
101
+ "path" : " /1/compositions/my-external-injection-compo" ,
102
+ "method" : " PUT" ,
103
+ "body" : {
104
+ "objectID" : " my-external-injection-compo" ,
105
+ "name" : " my first composition" ,
106
+ "behavior" : {
107
+ "injection" : {
108
+ "main" : {
109
+ "source" : {
110
+ "search" : {
111
+ "index" : " foo"
112
+ }
113
+ }
114
+ },
115
+ "injectedItems" : [
116
+ {
117
+ "key" : " injectedItem1" ,
118
+ "source" : {
119
+ "external" : {
120
+ "index" : " foo" ,
121
+ "ordering" : " userDefined" ,
122
+ "params" : {
123
+ "filters" : " brand:adidas"
124
+ }
125
+ }
126
+ },
127
+ "position" : 2 ,
128
+ "length" : 1
129
+ }
130
+ ]
131
+ }
132
+ }
133
+ }
134
+ }
64
135
}
65
136
]
Original file line number Diff line number Diff line change 13
13
"params" : { "query" : " batman" }
14
14
}
15
15
}
16
+ },
17
+ {
18
+ "parameters" : {
19
+ "compositionID" : " foo" ,
20
+ "requestBody" : {
21
+ "params" : {
22
+ "query" : " batman" ,
23
+ "injectedItems" : {
24
+ "injectedItem1" : {
25
+ "items" : [
26
+ {
27
+ "objectID" : " my-object-1"
28
+ },
29
+ {
30
+ "objectID" : " my-object-2" ,
31
+ "metadata" : {
32
+ "my-key" : " my-value"
33
+ }
34
+ }
35
+ ]
36
+ }
37
+ }
38
+ }
39
+ }
40
+ },
41
+ "request" : {
42
+ "path" : " /1/compositions/foo/run" ,
43
+ "method" : " POST" ,
44
+ "body" : {
45
+ "params" : {
46
+ "query" : " batman" ,
47
+ "injectedItems" : {
48
+ "injectedItem1" : {
49
+ "items" : [
50
+ {
51
+ "objectID" : " my-object-1"
52
+ },
53
+ {
54
+ "objectID" : " my-object-2" ,
55
+ "metadata" : {
56
+ "my-key" : " my-value"
57
+ }
58
+ }
59
+ ]
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
16
65
}
17
66
]
You can’t perform that action at this time.
0 commit comments