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

fix(specs): browse response required properties #3348

Merged
merged 7 commits into from
Jul 11, 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
4 changes: 3 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,9 @@ jobs:
needs:
- codegen
- check_green
if: ${{ github.ref == 'refs/heads/main' }}
if: |
always() &&
github.ref == 'refs/heads/main'
permissions:
pull-requests: write
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen {
"removewordsifnoresults",
"renderingcontent",
"rerankingapplyfilter",
"searchpagination",
"searchparams",
"searchparamsobject",
"searchparamsquery",
Expand Down
6 changes: 3 additions & 3 deletions specs/analytics/common/schemas/getTopSearches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ topSearchesResponse:
count:
$ref: '../parameters.yml#/count'
nbHits:
$ref: '../../../search/common/schemas/SearchResponse.yml#/nbHits'
$ref: '../../../common/schemas/SearchResponse.yml#/nbHits'

topSearchesResponseWithAnalytics:
type: object
Expand Down Expand Up @@ -69,7 +69,7 @@ topSearchesResponseWithAnalytics:
conversionCount:
$ref: '../parameters.yml#/conversionCount'
nbHits:
$ref: '../../../search/common/schemas/SearchResponse.yml#/nbHits'
$ref: '../../../common/schemas/SearchResponse.yml#/nbHits'

topSearchesResponseWithRevenueAnalytics:
type: object
Expand Down Expand Up @@ -121,7 +121,7 @@ topSearchesResponseWithRevenueAnalytics:
conversionCount:
$ref: '../parameters.yml#/conversionCount'
nbHits:
$ref: '../../../search/common/schemas/SearchResponse.yml#/nbHits'
$ref: '../../../common/schemas/SearchResponse.yml#/nbHits'
currencies:
$ref: '../parameters.yml#/currencies'
addToCartRate:
Expand Down
2 changes: 1 addition & 1 deletion specs/analytics/paths/search/getSearchesNoClicks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ get:
minimum: 1
example: 7
nbHits:
$ref: '../../../search/common/schemas/SearchResponse.yml#/nbHits'
$ref: '../../../common/schemas/SearchResponse.yml#/nbHits'
'400':
$ref: '../../../common/responses/BadRequest.yml'
'402':
Expand Down
212 changes: 212 additions & 0 deletions specs/common/schemas/SearchResponse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
baseSearchResponse:
type: object
additionalProperties: true
required:
- processingTimeMS
properties:
abTestID:
type: integer
description: A/B test ID. This is only included in the response for indices that are part of an A/B test.
abTestVariantID:
type: integer
minimum: 1
description: Variant ID. This is only included in the response for indices that are part of an A/B test.
aroundLatLng:
type: string
description: Computed geographical location.
example: '40.71,-74.01'
pattern: ^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$
automaticRadius:
type: string
description: Distance from a central coordinate provided by `aroundLatLng`.
exhaustive:
type: object
title: exhaustive
description: Whether certain properties of the search response are calculated exhaustive (exact) or approximated.
properties:
facetsCount:
type: boolean
title: facetsCount
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-).
facetValues:
type: boolean
title: facetValues
description: The value is `false` if not all facet values are retrieved.
nbHits:
type: boolean
title: nbHits
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.
rulesMatch:
type: boolean
title: rulesMatch
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.
typo:
type: boolean
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
exhaustiveNbHits:
type: boolean
description: See the `nbHits` field of the `exhaustive` object in the response.
deprecated: true
exhaustiveTypo:
type: boolean
description: See the `typo` field of the `exhaustive` object in the response.
deprecated: true
facets:
title: facets
type: object
additionalProperties:
x-additionalPropertiesName: facet
type: object
additionalProperties:
x-additionalPropertiesName: facet count
type: integer
description: Facet counts.
example:
category:
food: 1
tech: 42
facets_stats:
title: facetsStats
type: object
description: Statistics for numerical facets.
additionalProperties:
type: object
title: facetStats
properties:
min:
type: number
format: double
description: Minimum value in the results.
max:
type: number
format: double
description: Maximum value in the results.
avg:
type: number
format: double
description: Average facet value in the results.
sum:
type: number
format: double
description: Sum of all values in the results.
index:
type: string
example: indexName
description: Index name used for the query.
indexUsed:
type: string
description: Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query.
example: indexNameAlt
message:
type: string
description: Warnings about the query.
nbSortedHits:
type: integer
description: Number of hits selected and sorted by the relevant sort algorithm.
example: 20
parsedQuery:
type: string
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:
$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.
queryAfterRemoval:
type: string
description: Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set.
redirect:
title: redirect
type: object
description: |
[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.
properties:
index:
type: array
items:
$ref: '#/RedirectRuleIndexMetadata'
renderingContent:
$ref: './IndexSettings.yml#/renderingContent'
serverTimeMS:
type: integer
description: Time the server took to process the request, in milliseconds.
example: 20
serverUsed:
type: string
description: Host name of the server that processed the request.
example: 'c2-uk-3.algolia.net'
userData:
$ref: './IndexSettings.yml#/userData'
queryID:
type: string
description: Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
example: 'a00dbc80a8d13c4565a442e7e2dca80a'

nbHits:
type: integer
description: Number of results (hits).
example: 20

nbPages:
type: integer
description: Number of pages of results.
example: 1

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

RedirectRuleIndexMetadata:
type: object
properties:
source:
type: string
description: Source index for the redirect rule.
dest:
type: string
description: Destination index for the redirect rule.
reason:
type: string
description: Reason for the redirect rule.
succeed:
type: boolean
description: Redirect rule status.
data:
type: object
description: Redirect rule data.
required:
- ruleObjectID
properties:
ruleObjectID:
type: string
required:
- data
- succeed
- reason
- dest
- source

SearchPagination:
type: object
additionalProperties: false
properties:
page:
$ref: './SearchParams.yml#/page'
nbHits:
$ref: '#/nbHits'
nbPages:
$ref: '#/nbPages'
hitsPerPage:
$ref: './IndexSettings.yml#/hitsPerPage'
required:
- page
- nbHits
- nbPages
- hitsPerPage
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
recommendationsResults:
allOf:
# TODO: this isn't correct. Not all elements of the Search response are included for Recommend.
- $ref: '../../../search/common/schemas/SearchResponse.yml#/baseSearchResponse'
- $ref: '../../../common/schemas/SearchResponse.yml#/baseSearchResponse'
- $ref: '../../../common/schemas/SearchResponse.yml#/SearchPagination'
- $ref: '#/recommendationsHits'

recommendationsHits:
Expand Down
4 changes: 2 additions & 2 deletions specs/recommend/paths/searchRecommendRules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ post:
items:
$ref: '../common/schemas/RecommendRule.yml#/RecommendRule'
nbHits:
$ref: '../../search/common/schemas/SearchResponse.yml#/nbHits'
$ref: '../../common/schemas/SearchResponse.yml#/nbHits'
page:
$ref: '../../common/schemas/SearchParams.yml#/page'
nbPages:
$ref: '../../search/common/schemas/SearchResponse.yml#/nbPages'
$ref: '../../common/schemas/SearchResponse.yml#/nbPages'
'400':
$ref: '../../common/responses/BadRequest.yml'
'402':
Expand Down
16 changes: 15 additions & 1 deletion specs/search/common/schemas/BrowseResponse.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
browseResponse:
allOf:
- $ref: './SearchResponse.yml#/baseSearchResponse'
- $ref: '../../../common/schemas/SearchResponse.yml#/baseSearchResponse'
- $ref: '#/BrowsePagination'
- $ref: './SearchResponse.yml#/searchHits'
- $ref: './BrowseParams.yml#/cursor'

BrowsePagination:
type: object
additionalProperties: false
properties:
page:
$ref: '../../../common/schemas/SearchParams.yml#/page'
nbHits:
$ref: '../../../common/schemas/SearchResponse.yml#/nbHits'
nbPages:
$ref: '../../../common/schemas/SearchResponse.yml#/nbPages'
hitsPerPage:
$ref: '../../../common/schemas/IndexSettings.yml#/hitsPerPage'
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ searchForFacetValuesResponse:
Whether the facet count is exhaustive (true) or approximate (false).
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-).
processingTimeMS:
$ref: 'SearchResponse.yml#/processingTimeMS'
$ref: '../../../common/schemas/SearchResponse.yml#/processingTimeMS'
Loading
Loading