Skip to content

Commit a009967

Browse files
authored
fix(specs): browse response required properties (#3348)
1 parent 2d0827d commit a009967

File tree

14 files changed

+250
-223
lines changed

14 files changed

+250
-223
lines changed

.github/workflows/check.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,9 @@ jobs:
520520
needs:
521521
- codegen
522522
- check_green
523-
if: ${{ github.ref == 'refs/heads/main' }}
523+
if: |
524+
always() &&
525+
github.ref == 'refs/heads/main'
524526
permissions:
525527
pull-requests: write
526528
steps:

generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen {
9090
"removewordsifnoresults",
9191
"renderingcontent",
9292
"rerankingapplyfilter",
93+
"searchpagination",
9394
"searchparams",
9495
"searchparamsobject",
9596
"searchparamsquery",

specs/analytics/common/schemas/getTopSearches.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ topSearchesResponse:
2222
count:
2323
$ref: '../parameters.yml#/count'
2424
nbHits:
25-
$ref: '../../../search/common/schemas/SearchResponse.yml#/nbHits'
25+
$ref: '../../../common/schemas/SearchResponse.yml#/nbHits'
2626

2727
topSearchesResponseWithAnalytics:
2828
type: object
@@ -69,7 +69,7 @@ topSearchesResponseWithAnalytics:
6969
conversionCount:
7070
$ref: '../parameters.yml#/conversionCount'
7171
nbHits:
72-
$ref: '../../../search/common/schemas/SearchResponse.yml#/nbHits'
72+
$ref: '../../../common/schemas/SearchResponse.yml#/nbHits'
7373

7474
topSearchesResponseWithRevenueAnalytics:
7575
type: object
@@ -121,7 +121,7 @@ topSearchesResponseWithRevenueAnalytics:
121121
conversionCount:
122122
$ref: '../parameters.yml#/conversionCount'
123123
nbHits:
124-
$ref: '../../../search/common/schemas/SearchResponse.yml#/nbHits'
124+
$ref: '../../../common/schemas/SearchResponse.yml#/nbHits'
125125
currencies:
126126
$ref: '../parameters.yml#/currencies'
127127
addToCartRate:

specs/analytics/paths/search/getSearchesNoClicks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ get:
5252
minimum: 1
5353
example: 7
5454
nbHits:
55-
$ref: '../../../search/common/schemas/SearchResponse.yml#/nbHits'
55+
$ref: '../../../common/schemas/SearchResponse.yml#/nbHits'
5656
'400':
5757
$ref: '../../../common/responses/BadRequest.yml'
5858
'402':
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
baseSearchResponse:
2+
type: object
3+
additionalProperties: true
4+
required:
5+
- processingTimeMS
6+
properties:
7+
abTestID:
8+
type: integer
9+
description: A/B test ID. This is only included in the response for indices that are part of an A/B test.
10+
abTestVariantID:
11+
type: integer
12+
minimum: 1
13+
description: Variant ID. This is only included in the response for indices that are part of an A/B test.
14+
aroundLatLng:
15+
type: string
16+
description: Computed geographical location.
17+
example: '40.71,-74.01'
18+
pattern: ^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$
19+
automaticRadius:
20+
type: string
21+
description: Distance from a central coordinate provided by `aroundLatLng`.
22+
exhaustive:
23+
type: object
24+
title: exhaustive
25+
description: Whether certain properties of the search response are calculated exhaustive (exact) or approximated.
26+
properties:
27+
facetsCount:
28+
type: boolean
29+
title: facetsCount
30+
description: Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-).
31+
facetValues:
32+
type: boolean
33+
title: facetValues
34+
description: The value is `false` if not all facet values are retrieved.
35+
nbHits:
36+
type: boolean
37+
title: nbHits
38+
description: Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query.
39+
rulesMatch:
40+
type: boolean
41+
title: rulesMatch
42+
description: Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large.
43+
typo:
44+
type: boolean
45+
title: typo
46+
description: Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled.
47+
exhaustiveFacetsCount:
48+
type: boolean
49+
description: See the `facetsCount` field of the `exhaustive` object in the response.
50+
deprecated: true
51+
exhaustiveNbHits:
52+
type: boolean
53+
description: See the `nbHits` field of the `exhaustive` object in the response.
54+
deprecated: true
55+
exhaustiveTypo:
56+
type: boolean
57+
description: See the `typo` field of the `exhaustive` object in the response.
58+
deprecated: true
59+
facets:
60+
title: facets
61+
type: object
62+
additionalProperties:
63+
x-additionalPropertiesName: facet
64+
type: object
65+
additionalProperties:
66+
x-additionalPropertiesName: facet count
67+
type: integer
68+
description: Facet counts.
69+
example:
70+
category:
71+
food: 1
72+
tech: 42
73+
facets_stats:
74+
title: facetsStats
75+
type: object
76+
description: Statistics for numerical facets.
77+
additionalProperties:
78+
type: object
79+
title: facetStats
80+
properties:
81+
min:
82+
type: number
83+
format: double
84+
description: Minimum value in the results.
85+
max:
86+
type: number
87+
format: double
88+
description: Maximum value in the results.
89+
avg:
90+
type: number
91+
format: double
92+
description: Average facet value in the results.
93+
sum:
94+
type: number
95+
format: double
96+
description: Sum of all values in the results.
97+
index:
98+
type: string
99+
example: indexName
100+
description: Index name used for the query.
101+
indexUsed:
102+
type: string
103+
description: Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query.
104+
example: indexNameAlt
105+
message:
106+
type: string
107+
description: Warnings about the query.
108+
nbSortedHits:
109+
type: integer
110+
description: Number of hits selected and sorted by the relevant sort algorithm.
111+
example: 20
112+
parsedQuery:
113+
type: string
114+
description: Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.
115+
example: 'george clo'
116+
processingTimeMS:
117+
$ref: '#/processingTimeMS'
118+
processingTimingsMS:
119+
type: object
120+
description: Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues.
121+
queryAfterRemoval:
122+
type: string
123+
description: Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set.
124+
redirect:
125+
title: redirect
126+
type: object
127+
description: |
128+
[Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/), this this parameter is for internal use only.
129+
properties:
130+
index:
131+
type: array
132+
items:
133+
$ref: '#/RedirectRuleIndexMetadata'
134+
renderingContent:
135+
$ref: './IndexSettings.yml#/renderingContent'
136+
serverTimeMS:
137+
type: integer
138+
description: Time the server took to process the request, in milliseconds.
139+
example: 20
140+
serverUsed:
141+
type: string
142+
description: Host name of the server that processed the request.
143+
example: 'c2-uk-3.algolia.net'
144+
userData:
145+
$ref: './IndexSettings.yml#/userData'
146+
queryID:
147+
type: string
148+
description: Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
149+
example: 'a00dbc80a8d13c4565a442e7e2dca80a'
150+
151+
nbHits:
152+
type: integer
153+
description: Number of results (hits).
154+
example: 20
155+
156+
nbPages:
157+
type: integer
158+
description: Number of pages of results.
159+
example: 1
160+
161+
processingTimeMS:
162+
type: integer
163+
description: Time the server took to process the request, in milliseconds.
164+
example: 20
165+
166+
RedirectRuleIndexMetadata:
167+
type: object
168+
properties:
169+
source:
170+
type: string
171+
description: Source index for the redirect rule.
172+
dest:
173+
type: string
174+
description: Destination index for the redirect rule.
175+
reason:
176+
type: string
177+
description: Reason for the redirect rule.
178+
succeed:
179+
type: boolean
180+
description: Redirect rule status.
181+
data:
182+
type: object
183+
description: Redirect rule data.
184+
required:
185+
- ruleObjectID
186+
properties:
187+
ruleObjectID:
188+
type: string
189+
required:
190+
- data
191+
- succeed
192+
- reason
193+
- dest
194+
- source
195+
196+
SearchPagination:
197+
type: object
198+
additionalProperties: false
199+
properties:
200+
page:
201+
$ref: './SearchParams.yml#/page'
202+
nbHits:
203+
$ref: '#/nbHits'
204+
nbPages:
205+
$ref: '#/nbPages'
206+
hitsPerPage:
207+
$ref: './IndexSettings.yml#/hitsPerPage'
208+
required:
209+
- page
210+
- nbHits
211+
- nbPages
212+
- hitsPerPage

specs/recommend/common/schemas/RecommendationsResponse.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
recommendationsResults:
22
allOf:
33
# TODO: this isn't correct. Not all elements of the Search response are included for Recommend.
4-
- $ref: '../../../search/common/schemas/SearchResponse.yml#/baseSearchResponse'
4+
- $ref: '../../../common/schemas/SearchResponse.yml#/baseSearchResponse'
5+
- $ref: '../../../common/schemas/SearchResponse.yml#/SearchPagination'
56
- $ref: '#/recommendationsHits'
67

78
recommendationsHits:

specs/recommend/paths/searchRecommendRules.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ post:
7676
items:
7777
$ref: '../common/schemas/RecommendRule.yml#/RecommendRule'
7878
nbHits:
79-
$ref: '../../search/common/schemas/SearchResponse.yml#/nbHits'
79+
$ref: '../../common/schemas/SearchResponse.yml#/nbHits'
8080
page:
8181
$ref: '../../common/schemas/SearchParams.yml#/page'
8282
nbPages:
83-
$ref: '../../search/common/schemas/SearchResponse.yml#/nbPages'
83+
$ref: '../../common/schemas/SearchResponse.yml#/nbPages'
8484
'400':
8585
$ref: '../../common/responses/BadRequest.yml'
8686
'402':
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
browseResponse:
22
allOf:
3-
- $ref: './SearchResponse.yml#/baseSearchResponse'
3+
- $ref: '../../../common/schemas/SearchResponse.yml#/baseSearchResponse'
4+
- $ref: '#/BrowsePagination'
45
- $ref: './SearchResponse.yml#/searchHits'
56
- $ref: './BrowseParams.yml#/cursor'
7+
8+
BrowsePagination:
9+
type: object
10+
additionalProperties: false
11+
properties:
12+
page:
13+
$ref: '../../../common/schemas/SearchParams.yml#/page'
14+
nbHits:
15+
$ref: '../../../common/schemas/SearchResponse.yml#/nbHits'
16+
nbPages:
17+
$ref: '../../../common/schemas/SearchResponse.yml#/nbPages'
18+
hitsPerPage:
19+
$ref: '../../../common/schemas/IndexSettings.yml#/hitsPerPage'

specs/search/common/schemas/SearchForFacetValuesResponse.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ searchForFacetValuesResponse:
3434
Whether the facet count is exhaustive (true) or approximate (false).
3535
For more information, see [Why are my facet and hit counts not accurate](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-).
3636
processingTimeMS:
37-
$ref: 'SearchResponse.yml#/processingTimeMS'
37+
$ref: '../../../common/schemas/SearchResponse.yml#/processingTimeMS'

0 commit comments

Comments
 (0)