Skip to content

Commit 4bd1674

Browse files
committed
fix: duplicate & modify baseSearchResponse
1 parent 00e4e13 commit 4bd1674

File tree

2 files changed

+158
-23
lines changed

2 files changed

+158
-23
lines changed

specs/common/schemas/SearchResponse.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
11
baseSearchResponse:
2-
additionalProperties: true
3-
allOf:
4-
- $ref: '#/rootSearchResponse'
5-
- $ref: '#/appliedRulesResponse'
6-
7-
appliedRulesResponse:
8-
type: object
9-
additionalProperties: true
10-
properties:
11-
appliedRules:
12-
description: Rules applied to the query.
13-
title: appliedRules
14-
type: array
15-
items:
16-
type: object
17-
18-
rootSearchResponse:
192
type: object
203
additionalProperties: true
214
required:
@@ -61,6 +44,12 @@ rootSearchResponse:
6144
type: boolean
6245
title: typo
6346
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+
appliedRules:
48+
description: Rules applied to the query.
49+
title: appliedRules
50+
type: array
51+
items:
52+
type: object
6453
exhaustiveFacetsCount:
6554
type: boolean
6655
description: See the `facetsCount` field of the `exhaustive` object in the response.

specs/composition/common/schemas/SearchResponse.yml

Lines changed: 152 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
searchResponse:
22
additionalProperties: true
33
allOf:
4-
- $ref: '#/compositionRootSearchResponse'
5-
- $ref: '../../../common/schemas/SearchResponse.yml#/rootSearchResponse'
4+
- $ref: '#/compositionBaseSearchResponse'
65
- $ref: '#/searchResults'
76

87
searchResults:
@@ -75,14 +74,162 @@ resultsInjectedItemInfoResponse:
7574
required:
7675
- key
7776

78-
compositionRootSearchResponse:
77+
# copy of specs/common/schemas/SearchResponse.yml/#baseSearchResponse without appliedRules
78+
compositionBaseSearchResponse:
7979
type: object
8080
additionalProperties: true
81+
required:
82+
- processingTimeMS
8183
properties:
8284
compositions:
83-
$ref: '#/compositionBaseSearchResponse'
85+
$ref: '#/compositionsSearchResponse'
86+
abTestID:
87+
type: integer
88+
description: A/B test ID. This is only included in the response for indices that are part of an A/B test.
89+
abTestVariantID:
90+
type: integer
91+
minimum: 1
92+
description: Variant ID. This is only included in the response for indices that are part of an A/B test.
93+
aroundLatLng:
94+
type: string
95+
description: Computed geographical location.
96+
example: '40.71,-74.01'
97+
pattern: ^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$
98+
automaticRadius:
99+
type: string
100+
description: Distance from a central coordinate provided by `aroundLatLng`.
101+
exhaustive:
102+
title: exhaustive
103+
type: object
104+
description: Whether certain properties of the search response are calculated exhaustive (exact) or approximated.
105+
properties:
106+
facetsCount:
107+
type: boolean
108+
title: facetsCount
109+
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-).
110+
facetValues:
111+
type: boolean
112+
title: facetValues
113+
description: The value is `false` if not all facet values are retrieved.
114+
nbHits:
115+
type: boolean
116+
title: nbHits
117+
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.
118+
rulesMatch:
119+
type: boolean
120+
title: rulesMatch
121+
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.
122+
typo:
123+
type: boolean
124+
title: typo
125+
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.
126+
exhaustiveFacetsCount:
127+
type: boolean
128+
description: See the `facetsCount` field of the `exhaustive` object in the response.
129+
deprecated: true
130+
exhaustiveNbHits:
131+
type: boolean
132+
description: See the `nbHits` field of the `exhaustive` object in the response.
133+
deprecated: true
134+
exhaustiveTypo:
135+
type: boolean
136+
description: See the `typo` field of the `exhaustive` object in the response.
137+
deprecated: true
138+
facets:
139+
title: facets
140+
type: object
141+
additionalProperties:
142+
x-additionalPropertiesName: facet
143+
type: object
144+
additionalProperties:
145+
x-additionalPropertiesName: facet count
146+
type: integer
147+
description: Facet counts.
148+
example:
149+
category:
150+
food: 1
151+
tech: 42
152+
facets_stats:
153+
type: object
154+
description: Statistics for numerical facets.
155+
additionalProperties:
156+
title: facetStats
157+
type: object
158+
properties:
159+
min:
160+
type: number
161+
format: double
162+
description: Minimum value in the results.
163+
max:
164+
type: number
165+
format: double
166+
description: Maximum value in the results.
167+
avg:
168+
type: number
169+
format: double
170+
description: Average facet value in the results.
171+
sum:
172+
type: number
173+
format: double
174+
description: Sum of all values in the results.
175+
index:
176+
type: string
177+
example: indexName
178+
description: Index name used for the query.
179+
indexUsed:
180+
type: string
181+
description: Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query.
182+
example: indexNameAlt
183+
message:
184+
type: string
185+
description: Warnings about the query.
186+
nbSortedHits:
187+
type: integer
188+
description: Number of hits selected and sorted by the relevant sort algorithm.
189+
example: 20
190+
parsedQuery:
191+
type: string
192+
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.
193+
example: 'george clo'
194+
processingTimeMS:
195+
$ref: '../../../common/schemas/SearchResponse.yml#/processingTimeMS'
196+
processingTimingsMS:
197+
type: object
198+
description: Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues.
199+
queryAfterRemoval:
200+
type: string
201+
description: Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set.
202+
redirect:
203+
title: redirect
204+
type: object
205+
description: |
206+
[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.
207+
properties:
208+
index:
209+
type: array
210+
items:
211+
$ref: '../../../common/schemas/SearchResponse.yml#/RedirectRuleIndexMetadata'
212+
renderingContent:
213+
$ref: '../../../common/schemas//IndexSettings.yml#/renderingContent'
214+
serverTimeMS:
215+
type: integer
216+
description: Time the server took to process the request, in milliseconds.
217+
example: 20
218+
serverUsed:
219+
type: string
220+
description: Host name of the server that processed the request.
221+
example: 'c2-uk-3.algolia.net'
222+
userData:
223+
$ref: '../../../common/schemas//IndexSettings.yml#/userData'
224+
queryID:
225+
type: string
226+
description: Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
227+
example: 'a00dbc80a8d13c4565a442e7e2dca80a'
228+
_automaticInsights:
229+
type: boolean
230+
description: Whether automatic events collection is enabled for the application.
84231

85-
compositionBaseSearchResponse:
232+
compositionsSearchResponse:
86233
type: object
87234
additionalProperties: true
88235
properties:
@@ -111,4 +258,3 @@ compositionRunSearchResponse:
111258
- objectID
112259
required:
113260
- objectID
114-
- appliedRules

0 commit comments

Comments
 (0)