diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index ce79b6d6b5..2b31784839 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -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: diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java index f5d682ca84..f5f03ca6fc 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java @@ -90,6 +90,7 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen { "removewordsifnoresults", "renderingcontent", "rerankingapplyfilter", + "searchpagination", "searchparams", "searchparamsobject", "searchparamsquery", diff --git a/specs/analytics/common/schemas/getTopSearches.yml b/specs/analytics/common/schemas/getTopSearches.yml index 170b561c84..a0a9805dd7 100644 --- a/specs/analytics/common/schemas/getTopSearches.yml +++ b/specs/analytics/common/schemas/getTopSearches.yml @@ -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 @@ -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 @@ -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: diff --git a/specs/analytics/paths/search/getSearchesNoClicks.yml b/specs/analytics/paths/search/getSearchesNoClicks.yml index 480421cfa9..2aa26f6e18 100644 --- a/specs/analytics/paths/search/getSearchesNoClicks.yml +++ b/specs/analytics/paths/search/getSearchesNoClicks.yml @@ -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': diff --git a/specs/common/schemas/SearchResponse.yml b/specs/common/schemas/SearchResponse.yml new file mode 100644 index 0000000000..231acd48ad --- /dev/null +++ b/specs/common/schemas/SearchResponse.yml @@ -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 diff --git a/specs/recommend/common/schemas/RecommendationsResponse.yml b/specs/recommend/common/schemas/RecommendationsResponse.yml index 5fd1706c00..00e7640318 100644 --- a/specs/recommend/common/schemas/RecommendationsResponse.yml +++ b/specs/recommend/common/schemas/RecommendationsResponse.yml @@ -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: diff --git a/specs/recommend/paths/searchRecommendRules.yml b/specs/recommend/paths/searchRecommendRules.yml index d8fb9f4c5a..71ecf17f5c 100644 --- a/specs/recommend/paths/searchRecommendRules.yml +++ b/specs/recommend/paths/searchRecommendRules.yml @@ -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': diff --git a/specs/search/common/schemas/BrowseResponse.yml b/specs/search/common/schemas/BrowseResponse.yml index c385fb74c8..1ddc4466da 100644 --- a/specs/search/common/schemas/BrowseResponse.yml +++ b/specs/search/common/schemas/BrowseResponse.yml @@ -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' diff --git a/specs/search/common/schemas/SearchForFacetValuesResponse.yml b/specs/search/common/schemas/SearchForFacetValuesResponse.yml index 5758ccaa51..330cb86b7e 100644 --- a/specs/search/common/schemas/SearchForFacetValuesResponse.yml +++ b/specs/search/common/schemas/SearchForFacetValuesResponse.yml @@ -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' diff --git a/specs/search/common/schemas/SearchResponse.yml b/specs/search/common/schemas/SearchResponse.yml index 3b004e9065..5ffdff4275 100644 --- a/specs/search/common/schemas/SearchResponse.yml +++ b/specs/search/common/schemas/SearchResponse.yml @@ -1,7 +1,8 @@ searchResponse: additionalProperties: true allOf: - - $ref: '#/baseSearchResponse' + - $ref: '../../../common/schemas/SearchResponse.yml#/baseSearchResponse' + - $ref: '../../../common/schemas/SearchResponse.yml#/SearchPagination' - $ref: '#/searchHits' searchHits: @@ -26,210 +27,3 @@ searchHits: - hits - query - params - -baseSearchResponse: - type: object - additionalProperties: true - required: - - nbHits - - page - - nbPages - - hitsPerPage - - 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. - hitsPerPage: - $ref: '../../../common/schemas/IndexSettings.yml#/hitsPerPage' - 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. - nbHits: - $ref: '#/nbHits' - nbPages: - $ref: '#/nbPages' - nbSortedHits: - type: integer - description: Number of hits selected and sorted by the relevant sort algorithm. - example: 20 - page: - $ref: '../../../common/schemas/SearchParams.yml#/page' - 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: '../../../common/schemas/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: '../../../common/schemas/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 diff --git a/specs/search/paths/dictionaries/common/schemas/SearchDictionaryEntriesResponse.yml b/specs/search/paths/dictionaries/common/schemas/SearchDictionaryEntriesResponse.yml index 1598517bbd..0b022825d2 100644 --- a/specs/search/paths/dictionaries/common/schemas/SearchDictionaryEntriesResponse.yml +++ b/specs/search/paths/dictionaries/common/schemas/SearchDictionaryEntriesResponse.yml @@ -10,9 +10,9 @@ searchDictionaryEntriesResponse: page: $ref: '../../../../../common/parameters.yml#/page' nbHits: - $ref: '../../../../common/schemas/SearchResponse.yml#/nbHits' + $ref: '../../../../../common/schemas/SearchResponse.yml#/nbHits' nbPages: - $ref: '../../../../common/schemas/SearchResponse.yml#/nbPages' + $ref: '../../../../../common/schemas/SearchResponse.yml#/nbPages' required: - hits - page diff --git a/specs/search/paths/multiclusters/searchUserIds.yml b/specs/search/paths/multiclusters/searchUserIds.yml index 3e57296837..0fbf6cd48f 100644 --- a/specs/search/paths/multiclusters/searchUserIds.yml +++ b/specs/search/paths/multiclusters/searchUserIds.yml @@ -80,7 +80,7 @@ post: - objectID - _highlightResult nbHits: - $ref: '../../common/schemas/SearchResponse.yml#/nbHits' + $ref: '../../../common/schemas/SearchResponse.yml#/nbHits' page: $ref: '../../../common/schemas/SearchParams.yml#/page' hitsPerPage: diff --git a/specs/search/paths/synonyms/common/schemas.yml b/specs/search/paths/synonyms/common/schemas.yml index e04b32c175..e03a5aa353 100644 --- a/specs/search/paths/synonyms/common/schemas.yml +++ b/specs/search/paths/synonyms/common/schemas.yml @@ -58,7 +58,7 @@ searchSynonymsResponse: hits: $ref: '#/synonymHits' nbHits: - $ref: '../../../common/schemas/SearchResponse.yml#/nbHits' + $ref: '../../../../common/schemas/SearchResponse.yml#/nbHits' required: - hits - nbHits diff --git a/templates/javascript/clients/algoliasearch/builds/models.mustache b/templates/javascript/clients/algoliasearch/builds/models.mustache index 64ac7c5ffc..49a23b9af2 100644 --- a/templates/javascript/clients/algoliasearch/builds/models.mustache +++ b/templates/javascript/clients/algoliasearch/builds/models.mustache @@ -15,6 +15,7 @@ import { AroundRadiusAll, AutomaticFacetFilter, AutomaticFacetFilters, + BrowsePagination, BaseSearchParams, BaseSearchParamsWithoutQuery, BaseSearchResponse, @@ -63,6 +64,7 @@ import { RemoveStopWords, RemoveWordsIfNoResults, RenderingContent, + SearchPagination, SearchParams, SearchParamsObject, SearchParamsQuery, @@ -152,6 +154,7 @@ export { SearchParamsObject, SearchParamsQuery, SemanticSearch, + SearchPagination, SnippetResult, SnippetResultOption, SortRemainingBy, @@ -183,4 +186,4 @@ export type InitClientRegion = Partial<{ * Available regions of the initialized client. */ region: TRegion; -}>; \ No newline at end of file +}>;