Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(clients): deserialize in e2e and SFFV response #2500

Merged
merged 4 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ searchForFacetValuesResponse:
additionalProperties: false
required:
- facetHits
- exhaustiveFacetsCount
x-discriminator-fields:
- facetHits
properties:
Expand All @@ -26,3 +27,7 @@ searchForFacetValuesResponse:
count:
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-).
type: integer
exhaustiveFacetsCount:
$ref: 'SearchResponse.yml#/exhaustiveFacetsCount'
processingTimeMS:
$ref: 'SearchResponse.yml#/processingTimeMS'
18 changes: 12 additions & 6 deletions specs/search/common/schemas/SearchResponse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ baseSearchResponse:
title: typo
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.
exhaustiveFacetsCount:
type: boolean
description: See the `facetsCount` field of the `exhaustive` object in the response.
deprecated: true
$ref: '#/exhaustiveFacetsCount'
exhaustiveNbHits:
type: boolean
description: See the `nbHits` field of the `exhaustive` object in the response.
Expand Down Expand Up @@ -149,9 +147,7 @@ baseSearchResponse:
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.
example: 'george clo'
processingTimeMS:
type: integer
description: Time the server took to process the request, in milliseconds.
example: 20
$ref: '#/processingTimeMS'
processingTimingsMS:
type: object
description: Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues.
Expand Down Expand Up @@ -191,6 +187,16 @@ nbPages:
description: Number of pages of results for the current query.
example: 1

exhaustiveFacetsCount:
type: boolean
description: See the `facetsCount` field of the `exhaustive` object in the response.
deprecated: true

processingTimeMS:
type: integer
description: Time the server took to process the request, in milliseconds.
example: 20

RedirectRuleIndexMetadata:
type: object
properties:
Expand Down
9 changes: 5 additions & 4 deletions templates/python/tests/requests/requests.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ class Test{{#lambda.pascalcase}}{{{client}}}{{/lambda.pascalcase}}{{#isE2E}}E2E{
{{/request}}

{{#response}}
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}})

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}})
{{#statusCode}}
assert resp.status_code == {{statusCode}}
assert raw_resp.status_code == {{statusCode}}
{{/statusCode}}

{{#body}}
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}})
_expected_body = loads("""{{{.}}}""")
assert self._helpers.union(_expected_body, loads(resp.raw_data)) == _expected_body
assert self._helpers.union(_expected_body, loads(resp.to_json())) == _expected_body
{{/body}}
{{/response}}

Expand Down
1 change: 0 additions & 1 deletion tests/CTS/requests/search/getSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"minWordSizefor2Typos": 8,
"hitsPerPage": 20,
"maxValuesPerFacet": 100,
"version": 1,
"paginationLimitedTo": 10,
"exactOnSingleWordQuery": "attribute",
"ranking": [
Expand Down