Skip to content

Commit ae6adfb

Browse files
authored
fix(specs): port recommend changes (#2476)
1 parent f1eb132 commit ae6adfb

14 files changed

+169
-118
lines changed

specs/common/schemas/SearchParams.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,7 @@ baseSearchParamsWithoutQuery:
136136
x-categories:
137137
- Personalization
138138
userToken:
139-
type: string
140-
description: Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search.
141-
example: '123456'
142-
x-categories:
143-
- Personalization
139+
$ref: '#/userToken'
144140
getRankingInfo:
145141
type: boolean
146142
description: Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information).
@@ -209,6 +205,13 @@ paramsAsString:
209205
type: string
210206
default: ''
211207

208+
userToken:
209+
type: string
210+
description: Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search.
211+
example: '123456'
212+
x-categories:
213+
- Personalization
214+
212215
query:
213216
type: string
214217
description: Text to search for in an index.

specs/recommend/common/parameters.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ ObjectID:
1818
type: string
1919
description: Unique Recommend rule identifier.
2020
example: 'a-recommend-rule-id'
21+
22+
facetName:
23+
type: string
24+
description: Facet name for trending models.
25+
26+
facetValue:
27+
type: string
28+
description: Facet value for trending models.

specs/recommend/common/schemas/RecommendationsQuery.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
recommendationsQuery:
22
allOf:
3-
- $ref: '#/baseRecommendationsQuery'
43
- $ref: './RecommendationsRequest.yml#/baseRecommendRequest'
4+
- $ref: '#/baseRecommendationsQuery'
55

66
baseRecommendationsQuery:
77
type: object

specs/recommend/common/schemas/RecommendationsRequest.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
recommendationsRequest:
22
oneOf:
3-
- $ref: './TrendingQuery.yml#/trendingItemsQuery'
4-
- $ref: './TrendingQuery.yml#/trendingFacetsQuery'
3+
- $ref: './TrendingItemsQuery.yml#/trendingItemsQuery'
4+
- $ref: './TrendingFacetsQuery.yml#/trendingFacetsQuery'
55
- $ref: './RecommendationsQuery.yml#/recommendationsQuery'
6+
- $ref: './RecommendedForYouQuery.yml#/recommendedForYouQuery'
67

78
baseRecommendRequest:
89
type: object
Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
recommendationsResponse:
1+
recommendationsResults:
22
allOf:
33
- $ref: '../../../search/common/schemas/SearchResponse.yml#/baseSearchResponse'
4-
- $ref: '#/recommendHits'
4+
- $ref: '#/recommendationsHits'
55

6-
recommendHits:
6+
recommendationsHits:
77
type: object
88
additionalProperties: false
99
properties:
1010
hits:
1111
type: array
1212
items:
13-
$ref: '#/recommendHit'
13+
$ref: '#/recommendationsHit'
1414
query:
1515
$ref: '../../../common/schemas/SearchParams.yml#/query'
1616
params:
@@ -20,6 +20,11 @@ recommendHits:
2020
required:
2121
- hits
2222

23+
recommendationsHit:
24+
oneOf:
25+
- $ref: '#/recommendHit'
26+
- $ref: '#/trendingFacetHit'
27+
2328
recommendHit:
2429
type: object
2530
description: Recommend hit.
@@ -39,41 +44,26 @@ recommendHit:
3944
_distinctSeqID:
4045
$ref: '../../../search/common/schemas/Hit.yml#/_distinctSeqID'
4146
_score:
42-
type: number
43-
format: double
44-
minimum: 0
45-
maximum: 100
46-
description: Recommendation score.
47+
$ref: '#/recommendScore'
4748

48-
ruleResponse:
49+
trendingFacetHit:
4950
type: object
50-
description: Rule object.
51-
additionalProperties: false
52-
properties:
53-
_metadata:
54-
type: object
55-
properties:
56-
lastUpdate:
57-
$ref: '../../../common/responses/common.yml#/updatedAt'
58-
objectID:
59-
type: string
60-
description: Unique identifier for a rule object.
61-
example: 'hide-12345'
62-
conditions:
63-
type: array
64-
description: >
65-
[Conditions](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#conditions) required to activate a rule. You can use up to 25 conditions per rule.
66-
items:
67-
$ref: '../../../search/paths/rules/common/schemas.yml#/condition'
68-
consequence:
69-
$ref: '../../../search/paths/rules/common/schemas.yml#//consequence'
70-
description:
71-
type: string
72-
description: Description of the rule's purpose. This can be helpful for display in the Algolia dashboard.
73-
example: 'Display a promotional banner'
74-
enabled:
75-
type: boolean
76-
default: true
77-
description: Indicates whether to enable the rule. If it isn't enabled, it isn't applied at query time.
51+
description: Trending facet hit.
7852
required:
79-
- objectID
53+
- _score
54+
- facetName
55+
- facetValue
56+
properties:
57+
_score:
58+
$ref: '#/recommendScore'
59+
facetName:
60+
$ref: '../parameters.yml#/facetName'
61+
facetValue:
62+
$ref: '../parameters.yml#/facetValue'
63+
64+
recommendScore:
65+
type: number
66+
format: double
67+
minimum: 0
68+
maximum: 100
69+
description: Recommendation score.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
recommendedForYouQuery:
2+
allOf:
3+
- $ref: './RecommendationsRequest.yml#/baseRecommendRequest'
4+
- $ref: '#/baseRecommendedForYouQuery'
5+
6+
recommendedForYouQueryParameters:
7+
allOf:
8+
- $ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject'
9+
- $ref: '#/baseRecommendedForYouQueryParameters'
10+
11+
baseRecommendedForYouQueryParameters:
12+
type: object
13+
properties:
14+
userToken:
15+
$ref: '../../../common/schemas/SearchParams.yml#/userToken'
16+
required:
17+
- userToken
18+
19+
baseRecommendedForYouQuery:
20+
type: object
21+
additionalProperties: false
22+
properties:
23+
model:
24+
$ref: '#/recommendedForYouModel'
25+
queryParameters:
26+
$ref: '#/recommendedForYouQueryParameters'
27+
fallbackParameters:
28+
$ref: '#/recommendedForYouQueryParameters'
29+
required:
30+
- model
31+
32+
recommendedForYouModel:
33+
description: Recommended for you model.
34+
type: string
35+
enum: [recommended-for-you]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
type: object
2+
description: Rule object.
3+
additionalProperties: false
4+
properties:
5+
_metadata:
6+
type: object
7+
properties:
8+
lastUpdate:
9+
$ref: '../../../common/responses/common.yml#/updatedAt'
10+
objectID:
11+
type: string
12+
description: Unique identifier for a rule object.
13+
example: 'hide-12345'
14+
conditions:
15+
type: array
16+
description: >
17+
[Conditions](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#conditions) required to activate a rule. You can use up to 25 conditions per rule.
18+
items:
19+
$ref: '../../../search/paths/rules/common/schemas.yml#/condition'
20+
consequence:
21+
$ref: '../../../search/paths/rules/common/schemas.yml#//consequence'
22+
description:
23+
type: string
24+
description: Description of the rule's purpose. This can be helpful for display in the Algolia dashboard.
25+
example: 'Display a promotional banner'
26+
enabled:
27+
type: boolean
28+
default: true
29+
description: Indicates whether to enable the rule. If it isn't enabled, it isn't applied at query time.
30+
required:
31+
- objectID
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
trendingFacetsQuery:
2+
allOf:
3+
- $ref: './RecommendationsRequest.yml#/baseRecommendRequest'
4+
- $ref: '#/baseTrendingFacetsQuery'
5+
6+
baseTrendingFacetsQuery:
7+
type: object
8+
additionalProperties: false
9+
properties:
10+
facetName:
11+
$ref: '../parameters.yml#/facetName'
12+
model:
13+
$ref: '#/trendingFacetsModel'
14+
required:
15+
- facetName
16+
17+
trendingFacetsModel:
18+
description: Trending facets model.
19+
type: string
20+
enum: [trending-facets]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
trendingItemsQuery:
2+
allOf:
3+
- $ref: './RecommendationsRequest.yml#/baseRecommendRequest'
4+
- $ref: '#/baseTrendingItemsQuery'
5+
6+
baseTrendingItemsQuery:
7+
type: object
8+
additionalProperties: false
9+
properties:
10+
facetName:
11+
$ref: '../parameters.yml#/facetName'
12+
facetValue:
13+
$ref: '../parameters.yml#/facetValue'
14+
model:
15+
$ref: '#/trendingItemsModel'
16+
queryParameters:
17+
$ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject'
18+
fallbackParameters:
19+
$ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject'
20+
21+
trendingItemsModel:
22+
description: Trending items model.
23+
type: string
24+
enum: [trending-items]

specs/recommend/common/schemas/TrendingQuery.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)