meilisearch-swift
meilisearch-swift copied to clipboard
[v1.3] Search in facet values `facetSearch`
⚠️ 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/3611
- discussion: https://github.com/meilisearch/product/discussions/515#discussioncomment-6240970
- spec: https://github.com/meilisearch/specifications/pull/246
Users of bigger datasets could have difficulty interacting with vast lists of facets data since, until today, it was not possible to search on them.
To introduce this feature into the SDKs, we must:
Create a new method called facetSearch(facetSearchQuery)/facet_search(facetSearchQuery)
Besides all the other parameters that a regular SearchQuery can take. The new FacetSearchQuery can take a facetName, facetQuery, filter, q, matchingStrategy.
Params definition:
facetName:
type: string
required: true
example: '"genres"'
facetQuery:
type: string
example: '"Horror"'
q:
type: string
default: '""'
example: '"Back to the future"'
matchingStrategy:
type: string
default: 'last'
filter: // https://www.meilisearch.com/docs/learn/fine_tuning_results/filtering
type: array
example: '"groupId = 1 AND genre = adventure"'
Code samples
Inside of this file: .code-samples.meilisearch.yml:
- Create a new entry with this key
facet_search_1containing a call to the newfacetSearchmethod. With this value:{ "facetQuery": "fiction", "facetName": "genres", "filter": "rating > 3" }
Use this as a reference if the previous description was not helpful:
facet_search_1: |-
POST 'http://localhost:7700/indexes/books/facet-search'
with data: {
"facetQuery": "fiction",
"facetName": "genres",
"filter": "rating > 3"
}
- Add new code sample
facet_search_3with this content:
facet_search_3: |-
POST 'http://localhost:7700/indexes/books/facet-search'
with data: {
"facetQuery": "c",
"facetName": "genres"
}
TODO:
- [ ] Add the new method
facetSearch - [ ] Update the code-samples accordingly
- [ ] Add integration tests