meilisearch-swift
meilisearch-swift copied to clipboard
[v1.3] Sort facets value by alphanumerical or count order
⚠️ This issue is generated, it means the examples and the namings do not necessarily correspond to the language of this repository. Also, if you are a maintainer, please add any clarification and instructions about this issue.
Sorry if this is already wholly/partially implemented. Feel free to let me know about the state of this issue in the repo.
Related to https://github.com/meilisearch/integration-guides/issues/280
This issue is divided into two sections, first, you need to make the implementation, and second, you must update the code-samples (no one likes outdated docs, right?).
New implementation
Related to:
- issue: https://github.com/meilisearch/meilisearch/issues/3612
- discussion: https://github.com/meilisearch/product/discussions/519#discussioncomment-6030480
- spec: https://github.com/meilisearch/specifications/pull/247
Adds the ability to sort facets by their value which could be by using alpha or count.
Ensure the SDKs can handle the new index faceting configuration attribute sortFacetValuesBy. This enum could only take count or alpha.
The faceting configuration now have two attributes:
maxValuesPerFacet: integer
sortFacetValuesBy: object
index_name: alpha|count
*: alpha|count // when should be applied to all indexes
Code samples
Inside of this file: .code-samples.meilisearch.yml:
- Create a new entry with this key
facet_search_2containing a call to theupdateFacetingsettings method. With this value:"sortFacetValuesBy":{"genres": "count"}
Use this as a reference if the previous description was not helpful:
facet_search_2: |-
PATCH 'http://localhost:7700/indexes/books/settings/faceting'
with data: {
"sortFacetValuesBy": {
"genres": "count"
}
}
- Update
getting_started_facetingkey to contain the new behaviorsortFacetValuesBy
getting_started_faceting: |-
PATCH 'http://localhost:7700/indexes/movies/settings/faceting'
with data: {
"maxValuesPerFacet": 2,
"sortFacetValuesBy": {
"*": "count"
}
}
- Update
update_faceting_settings_1key to contain the new behaviorsortFacetValuesBy
update_faceting_settings_1: |-
PATCH 'http://localhost:7700/indexes/books/settings/faceting'
with data: {
"maxValuesPerFacet": 2,
"sortFacetValuesBy": {
"*": "alpha",
"genres": "count"
}
}
TODO:
- [ ] Add the ability receive a new param in the
updateFacetingsettings method calledsortFacetValuesBy. - [ ] Update the code-samples accordingly
- [ ] Add integration tests