Skip to content
Draft
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
20 changes: 20 additions & 0 deletions specs/composition/common/params/Composition.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# #########################
# ### Category Faceting ###
# #########################

facets:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

facets is already defined in the IndexSettings.yml file, and since it's imported in the composition spec, it will clash with this one and produce unpredictable naming, like IndexSettingsFacets.

It's not possible to override a model like that, either you would have to copy the entire IndexSettings.yml in here and edit the facets, or you need to rename this to something else like compositionFacets, but the facets object will still be generated with the other spec since it comes first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😭

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@millotp why does it workd for enableRules then ? It is exactly the same use case.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you take a look at the bundled spec it's the same issue, but by luck the one from composition was generated first for this one. I don't know how to control the order to prioritize the one from the composition spec

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but the Search API client is not disturbed by the Composition one in that case ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the type is still generated because it's used inside of the BaseSearchResponse.
I think the only solution is to copy the common spec into the composition spec sorry

type: array
items:
type: string
description: |
Facets for which to retrieve facet values that match the search criteria and the number of matching facet values
To retrieve all facets, use the wildcard character `*`.
To retrieve disjunctive facets lists, annotate any facets with the `disjunctive` modifier.
For more information, see [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts) and [disjunctive faceting for Smart Groups](https://www.algolia.com/doc/guides/managing-results/compositions/search-based-groups#facets-including-disjunctive-faceting).
default: []
example:
- ['category', 'disjunctive(brand)', 'price']
- ['*']
x-categories:
- Faceting

# ######################
# ### Category Rules ###
# ######################
Expand Down
3 changes: 0 additions & 3 deletions specs/composition/common/params/Search.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ enableRules:
exactOnSingleWordQuery:
$ref: '../../../common/schemas/IndexSettings.yml#/exactOnSingleWordQuery'

facets:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/facets'

facetFilters:
$ref: '../../../common/schemas/SearchParams.yml#/facetFilters'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ mainInjectionQueryParameters:
facetingAfterDistinct:
$ref: '../../params/Search.yml#/facetingAfterDistinct'
facets:
$ref: '../../params/Search.yml#/facets'
$ref: '../../params/Composition.yml#/facets'
hitsPerPage:
$ref: '../../params/Search.yml#/hitsPerPage'
maxValuesPerFacet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ params:
$ref: '../../params/Search.yml#/relevancyStrictness'
facetFilters:
$ref: '../../params/Search.yml#/facetFilters'
facets:
$ref: '../../params/Composition.yml#/facets'
optionalFilters:
$ref: '../../params/Search.yml#/optionalFilters'
numericFilters:
Expand Down
Loading