diff --git a/.github/.cache_version b/.github/.cache_version index 1750564f27..5a5831ab6b 100644 --- a/.github/.cache_version +++ b/.github/.cache_version @@ -1 +1 @@ -0.0.6 +0.0.7 diff --git a/.redocly.yaml b/.redocly.yaml index 5f4326c036..1472e32c56 100644 --- a/.redocly.yaml +++ b/.redocly.yaml @@ -1,4 +1,4 @@ -apiDefinitions: +apis: abtesting: specs/abtesting/spec.yml analytics: specs/analytics/spec.yml insights: specs/insights/spec.yml diff --git a/config/openapitools.json b/config/openapitools.json index 8a65d6ad5e..04dd052b83 100644 --- a/config/openapitools.json +++ b/config/openapitools.json @@ -4,21 +4,21 @@ "generators": { "javascript-search": { "output": "#{cwd}/clients/algoliasearch-client-javascript/packages/client-search", - "reservedWordsMappings": "queryParameters=queryParameters,requestOptions=requestOptions", + "reservedWordsMappings": "queryParameters=queryParameters,requestOptions=requestOptions,delete=delete", "additionalProperties": { "packageVersion": "0.6.1" } }, "javascript-lite": { "output": "#{cwd}/clients/algoliasearch-client-javascript/packages/algoliasearch/lite", - "reservedWordsMappings": "queryParameters=queryParameters,requestOptions=requestOptions", + "reservedWordsMappings": "queryParameters=queryParameters,requestOptions=requestOptions,delete=delete", "additionalProperties": { "packageVersion": "0.6.1" } }, "javascript-recommend": { "output": "#{cwd}/clients/algoliasearch-client-javascript/packages/recommend", - "reservedWordsMappings": "queryParameters=queryParameters", + "reservedWordsMappings": "queryParameters=queryParameters,delete=delete", "additionalProperties": { "packageVersion": "0.6.1" } diff --git a/specs/common/schemas/IndexSettings.yml b/specs/common/schemas/IndexSettings.yml index ae7fdfd7fa..8491f5a773 100644 --- a/specs/common/schemas/IndexSettings.yml +++ b/specs/common/schemas/IndexSettings.yml @@ -268,9 +268,7 @@ indexSettingsAsSearchParams: description: When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. default: false renderingContent: - type: object - description: Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. - default: {} + $ref: '#/renderingContent' maxFacetHits: type: integer @@ -356,3 +354,59 @@ removeStopWords: type: string - type: boolean default: false + +renderingContent: + description: Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + type: object + additionalProperties: false + properties: + facetOrdering: + $ref: '#/facetOrdering' + +facetOrdering: + description: Defining how facets should be ordered. + type: object + additionalProperties: false + properties: + facets: + $ref: '#/facets' + values: + $ref: '#/values' + +facets: + description: The ordering of facets (widgets). + type: object + additionalProperties: false + properties: + order: + $ref: '#/order' + +values: + description: The ordering of facet values, within an individual list. + type: object + additionalProperties: + $ref: '#/value' + +value: + type: object + additionalProperties: false + properties: + order: + $ref: '#/order' + sortRemainingBy: + $ref: '#/sortRemainingBy' + +order: + description: Pinned order of facet lists. + type: array + items: + type: string + +sortRemainingBy: + description: > + How to display the remaining items. + - `count`: facet count (descending). + - `alpha`: alphabetical (ascending). + - `hidden`: show only pinned values. + type: string + enum: [count, alpha, hidden] diff --git a/specs/search/paths/rules/common/schemas.yml b/specs/search/paths/rules/common/schemas.yml index 504d6d26aa..de1ebb58b0 100644 --- a/specs/search/paths/rules/common/schemas.yml +++ b/specs/search/paths/rules/common/schemas.yml @@ -114,18 +114,66 @@ params: additionalProperties: false properties: query: - type: string - description: Query string. + $ref: '#/query' automaticFacetFilters: + $ref: '#/automaticFacetFilters' + automaticOptionalFacetFilters: + $ref: '#/automaticOptionalFacetFilters' + renderingContent: + $ref: '../../../../common/schemas/IndexSettings.yml#/renderingContent' + +query: + description: When providing a string, it replaces the entire query string. When providing an object, it describes incremental edits to be made to the query string (but you can't do both). + oneOf: + - $ref: '#/consequenceQuery' + - type: string + +consequenceQuery: + type: object + additionalProperties: false + properties: + remove: + description: Words to remove. type: array - description: Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern. items: - $ref: '#/automaticFacetFilter' - automaticOptionalFacetFilters: - type: object - description: Same syntax as automaticFacetFilters, but the engine treats the filters as optional. + type: string + edits: + description: Edits to apply. + type: array + items: + $ref: '#/edit' + +edit: + type: object + additionalProperties: false + properties: + type: + $ref: '#/editType' + delete: + description: Text or patterns to remove from the query string. + type: string + insert: + description: Text that should be inserted in place of the removed text inside the query string. + type: string + +editType: + description: Type of edit. + type: string + enum: [remove, replace] + +automaticFacetFilters: + description: Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern. + oneOf: + - type: array items: $ref: '#/automaticFacetFilter' + - type: array + items: + type: string + +automaticOptionalFacetFilters: + description: Same syntax as automaticFacetFilters, but the engine treats the filters as optional. + $ref: '#/automaticFacetFilters' automaticFacetFilter: type: object diff --git a/tests/CTS/methods/requests/search/search.json b/tests/CTS/methods/requests/search/search.json index d02b29c5c9..cc5af2e650 100644 --- a/tests/CTS/methods/requests/search/search.json +++ b/tests/CTS/methods/requests/search/search.json @@ -328,7 +328,22 @@ ], "attributeCriteriaComputedByMinProximity": true, "renderingContent": { - "string": "any" + "facetOrdering": { + "facets": { + "order": [ + "a", + "b" + ] + }, + "values": { + "a": { + "order": [ + "b" + ], + "sortRemainingBy": "count" + } + } + } }, "type": "default" } @@ -470,7 +485,22 @@ ], "attributeCriteriaComputedByMinProximity": true, "renderingContent": { - "string": "any" + "facetOrdering": { + "facets": { + "order": [ + "a", + "b" + ] + }, + "values": { + "a": { + "order": [ + "b" + ], + "sortRemainingBy": "count" + } + } + } }, "type": "default" }