From b33c7b02cd8db1634ce01ef88d093fe8a63e6d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Denoix?= Date: Tue, 28 May 2024 13:19:56 +0200 Subject: [PATCH] chore: update search api specs (#157) Co-authored-by: algolia-ci --- api/specs/search.yml | 56 ++++++++++++++++++++------------------- pkg/cmdutil/spec_flags.go | 12 ++++----- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/api/specs/search.yml b/api/specs/search.yml index 17959a55..8243d1cb 100644 --- a/api/specs/search.yml +++ b/api/specs/search.yml @@ -3423,20 +3423,6 @@ components: example: (category:Book OR category:Ebook) AND _tags:published x-categories: - Filtering - searchFiltersArrayString: - title: search filter array - type: array - items: - type: string - mixedSearchFilters: - oneOf: - - $ref: '#/components/schemas/searchFiltersArrayString' - - type: string - listOfSearchFilters: - type: array - title: search filters - items: - $ref: '#/components/schemas/mixedSearchFilters' facetFilters: description: > Filter the search by facet values, so that only records with the same @@ -3465,7 +3451,9 @@ components: - category:-Movie - author:John Doe oneOf: - - $ref: '#/components/schemas/listOfSearchFilters' + - type: array + items: + $ref: '#/components/schemas/facetFilters' - type: string x-categories: - Filtering @@ -3493,7 +3481,9 @@ components: - category:Book - author:John Doe oneOf: - - $ref: '#/components/schemas/listOfSearchFilters' + - type: array + items: + $ref: '#/components/schemas/optionalFilters' - type: string x-categories: - Filtering @@ -3519,7 +3509,9 @@ components: - deliveryDate < 1441755506 - price < 1000 oneOf: - - $ref: '#/components/schemas/listOfSearchFilters' + - type: array + items: + $ref: '#/components/schemas/numericFilters' - type: string x-categories: - Filtering @@ -3544,7 +3536,9 @@ components: - Movie - SciFi oneOf: - - $ref: '#/components/schemas/listOfSearchFilters' + - type: array + items: + $ref: '#/components/schemas/tagFilters' - type: string x-categories: - Filtering @@ -4423,11 +4417,12 @@ components: Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/) to records that match these filters. oneOf: - - $ref: '#/components/schemas/listOfSearchFilters' + - type: array + items: + $ref: '#/components/schemas/reRankingApplyFilter' - type: string x-categories: - Filtering - - type: 'null' indexSettingsAsSearchParams: type: object additionalProperties: false @@ -5075,7 +5070,9 @@ components: x-categories: - Filtering reRankingApplyFilter: - $ref: '#/components/schemas/reRankingApplyFilter' + oneOf: + - $ref: '#/components/schemas/reRankingApplyFilter' + - type: 'null' searchParamsObject: title: Search parameters as object description: >- @@ -5088,10 +5085,6 @@ components: oneOf: - $ref: '#/components/schemas/searchParamsString' - $ref: '#/components/schemas/searchParamsObject' - exhaustiveFacetsCount: - type: boolean - description: See the `facetsCount` field of the `exhaustive` object in the response. - deprecated: true nbHits: type: integer description: Number of results (hits). @@ -5223,7 +5216,11 @@ components: alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. exhaustiveFacetsCount: - $ref: '#/components/schemas/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. @@ -5705,7 +5702,12 @@ components: approximated](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). type: integer exhaustiveFacetsCount: - $ref: '#/components/schemas/exhaustiveFacetsCount' + type: boolean + description: > + 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: '#/components/schemas/processingTimeMS' searchResult: diff --git a/pkg/cmdutil/spec_flags.go b/pkg/cmdutil/spec_flags.go index d99db963..aa3c0d1b 100644 --- a/pkg/cmdutil/spec_flags.go +++ b/pkg/cmdutil/spec_flags.go @@ -417,8 +417,8 @@ See: https://www.algolia.com/doc/api-reference/api-parameters/queryType/`)) cmd.Flags().StringSlice("ranking", []string{"typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}, heredoc.Doc(`Determines the order in which Algolia returns your results. See: https://www.algolia.com/doc/api-reference/api-parameters/ranking/`)) cmd.Flags().SetAnnotation("ranking", "Categories", []string{"Ranking"}) - reRankingApplyFilter := NewJSONVar([]string{"array", "string", "null"}...) - cmd.Flags().Var(reRankingApplyFilter, "reRankingApplyFilter", heredoc.Doc(`Restrict Dynamic Re-Ranking to records that match these filters.`)) + reRankingApplyFilter := NewJSONVar([]string{"", "null"}...) + cmd.Flags().Var(reRankingApplyFilter, "reRankingApplyFilter", heredoc.Doc(`.`)) cmd.Flags().Int("relevancyStrictness", 100, heredoc.Doc(`Relevancy threshold below which less relevant results aren't included in the results. See: https://www.algolia.com/doc/api-reference/api-parameters/relevancyStrictness/`)) cmd.Flags().SetAnnotation("relevancyStrictness", "Categories", []string{"Ranking"}) @@ -640,8 +640,8 @@ See: https://www.algolia.com/doc/api-reference/api-parameters/queryType/`)) cmd.Flags().StringSlice("ranking", []string{"typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}, heredoc.Doc(`Determines the order in which Algolia returns your results. See: https://www.algolia.com/doc/api-reference/api-parameters/ranking/`)) cmd.Flags().SetAnnotation("ranking", "Categories", []string{"Ranking"}) - reRankingApplyFilter := NewJSONVar([]string{"array", "string", "null"}...) - cmd.Flags().Var(reRankingApplyFilter, "reRankingApplyFilter", heredoc.Doc(`Restrict Dynamic Re-Ranking to records that match these filters.`)) + reRankingApplyFilter := NewJSONVar([]string{"", "null"}...) + cmd.Flags().Var(reRankingApplyFilter, "reRankingApplyFilter", heredoc.Doc(`.`)) cmd.Flags().Int("relevancyStrictness", 100, heredoc.Doc(`Relevancy threshold below which less relevant results aren't included in the results. See: https://www.algolia.com/doc/api-reference/api-parameters/relevancyStrictness/`)) cmd.Flags().SetAnnotation("relevancyStrictness", "Categories", []string{"Ranking"}) @@ -870,8 +870,8 @@ See: https://www.algolia.com/doc/api-reference/api-parameters/queryType/`)) cmd.Flags().StringSlice("ranking", []string{"typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}, heredoc.Doc(`Determines the order in which Algolia returns your results. See: https://www.algolia.com/doc/api-reference/api-parameters/ranking/`)) cmd.Flags().SetAnnotation("ranking", "Categories", []string{"Ranking"}) - reRankingApplyFilter := NewJSONVar([]string{"array", "string", "null"}...) - cmd.Flags().Var(reRankingApplyFilter, "reRankingApplyFilter", heredoc.Doc(`Restrict Dynamic Re-Ranking to records that match these filters.`)) + reRankingApplyFilter := NewJSONVar([]string{"", "null"}...) + cmd.Flags().Var(reRankingApplyFilter, "reRankingApplyFilter", heredoc.Doc(`.`)) cmd.Flags().Int("relevancyStrictness", 100, heredoc.Doc(`Relevancy threshold below which less relevant results aren't included in the results. See: https://www.algolia.com/doc/api-reference/api-parameters/relevancyStrictness/`)) cmd.Flags().SetAnnotation("relevancyStrictness", "Categories", []string{"Ranking"})