Skip to content

Commit ae20258

Browse files
authored
feat(clients): deserialize in e2e and SFFV response (#2500)
1 parent c43622f commit ae20258

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

specs/search/common/schemas/SearchForFacetValuesResponse.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ searchForFacetValuesResponse:
33
additionalProperties: false
44
required:
55
- facetHits
6+
- exhaustiveFacetsCount
67
x-discriminator-fields:
78
- facetHits
89
properties:
@@ -26,3 +27,7 @@ searchForFacetValuesResponse:
2627
count:
2728
description: Number of records containing this facet value. This takes into account the extra search parameters specified in the query. Like for a regular search query, the [counts may not be exhaustive](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-).
2829
type: integer
30+
exhaustiveFacetsCount:
31+
$ref: 'SearchResponse.yml#/exhaustiveFacetsCount'
32+
processingTimeMS:
33+
$ref: 'SearchResponse.yml#/processingTimeMS'

specs/search/common/schemas/SearchResponse.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ baseSearchResponse:
7474
title: typo
7575
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.
7676
exhaustiveFacetsCount:
77-
type: boolean
78-
description: See the `facetsCount` field of the `exhaustive` object in the response.
79-
deprecated: true
77+
$ref: '#/exhaustiveFacetsCount'
8078
exhaustiveNbHits:
8179
type: boolean
8280
description: See the `nbHits` field of the `exhaustive` object in the response.
@@ -149,9 +147,7 @@ baseSearchResponse:
149147
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.
150148
example: 'george clo'
151149
processingTimeMS:
152-
type: integer
153-
description: Time the server took to process the request, in milliseconds.
154-
example: 20
150+
$ref: '#/processingTimeMS'
155151
processingTimingsMS:
156152
type: object
157153
description: Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues.
@@ -191,6 +187,16 @@ nbPages:
191187
description: Number of pages of results for the current query.
192188
example: 1
193189

190+
exhaustiveFacetsCount:
191+
type: boolean
192+
description: See the `facetsCount` field of the `exhaustive` object in the response.
193+
deprecated: true
194+
195+
processingTimeMS:
196+
type: integer
197+
description: Time the server took to process the request, in milliseconds.
198+
example: 20
199+
194200
RedirectRuleIndexMetadata:
195201
type: object
196202
properties:

templates/python/tests/requests/requests.mustache

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ class Test{{#lambda.pascalcase}}{{{client}}}{{/lambda.pascalcase}}{{#isE2E}}E2E{
5050
{{/request}}
5151

5252
{{#response}}
53-
resp = await SearchClient(self._e2e_app_id, self._e2e_api_key).{{#lambda.snakecase}}{{method}}{{/lambda.snakecase}}_with_http_info({{#parametersWithDataType}}{{> requests/generateParams}}{{/parametersWithDataType}}{{#hasRequestOptions}} request_options={ {{#requestOptions.headers.parameters}}"headers":loads("""{{{.}}}"""),{{/requestOptions.headers.parameters}}{{#requestOptions.queryParameters.parameters}}"query_parameters":loads("""{{{.}}}"""),{{/requestOptions.queryParameters.parameters}} }{{/hasRequestOptions}})
54-
53+
raw_resp = await SearchClient(self._e2e_app_id, self._e2e_api_key).{{#lambda.snakecase}}{{method}}{{/lambda.snakecase}}_with_http_info({{#parametersWithDataType}}{{> requests/generateParams}}{{/parametersWithDataType}}{{#hasRequestOptions}} request_options={ {{#requestOptions.headers.parameters}}"headers":loads("""{{{.}}}"""),{{/requestOptions.headers.parameters}}{{#requestOptions.queryParameters.parameters}}"query_parameters":loads("""{{{.}}}"""),{{/requestOptions.queryParameters.parameters}} }{{/hasRequestOptions}})
5554
{{#statusCode}}
56-
assert resp.status_code == {{statusCode}}
55+
assert raw_resp.status_code == {{statusCode}}
5756
{{/statusCode}}
57+
5858
{{#body}}
59+
resp = await SearchClient(self._e2e_app_id, self._e2e_api_key).{{#lambda.snakecase}}{{method}}{{/lambda.snakecase}}({{#parametersWithDataType}}{{> requests/generateParams}}{{/parametersWithDataType}}{{#hasRequestOptions}} request_options={ {{#requestOptions.headers.parameters}}"headers":loads("""{{{.}}}"""),{{/requestOptions.headers.parameters}}{{#requestOptions.queryParameters.parameters}}"query_parameters":loads("""{{{.}}}"""),{{/requestOptions.queryParameters.parameters}} }{{/hasRequestOptions}})
5960
_expected_body = loads("""{{{.}}}""")
60-
assert self._helpers.union(_expected_body, loads(resp.raw_data)) == _expected_body
61+
assert self._helpers.union(_expected_body, loads(resp.to_json())) == _expected_body
6162
{{/body}}
6263
{{/response}}
6364

tests/CTS/requests/search/getSettings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"minWordSizefor2Typos": 8,
1515
"hitsPerPage": 20,
1616
"maxValuesPerFacet": 100,
17-
"version": 1,
1817
"paginationLimitedTo": 10,
1918
"exactOnSingleWordQuery": "attribute",
2019
"ranking": [

0 commit comments

Comments
 (0)