meilisearch-swift
meilisearch-swift copied to clipboard
v0.29: Add support to matchingPolicy search request parameter
trafficstars
This improvement motivation is about letting the user customize the behavior of Meilisearch when retrieving documents according to the query words.
- Add a
matchingStrategyparameter to search requests viaSearchParameters. - The value last is the default strategy if the field is not specified.
- This field can receive only two valid options
last,allorfrequency.
Expected result:
let searchParameters = SearchParameters(
query: "shifu",
matchingStrategy: "last",
attributesToCrop: ["overview"],
cropMarker: "[…]"
)
client.index("movies").search(searchParameters) { (result) in ... }
Good to have: Make the last or all constants where we can quickly use them without mistakes.
--
TODO
- [ ] Implement changes
- [ ] Add tests
- [ ] Add code samples
- [ ] Add
search_parameter_guide_matching_strategy_1- Search for
big fat liarwith"matchingStrategy": "last"in amoviesindex.
- Search for
- [ ] Add
search_parameter_guide_matching_strategy_2- Search for
big fat liarwith"matchingStrategy": "all"in amoviesindex.
- Search for
- [ ] Add
search_parameter_guide_matching_strategy_3key and “translate” the following curl example by using the newly added methods: https://github.com/meilisearch/documentation/blob/04f26a35771305378ed0a506f4d60ef06d07bd7e/.code-samples.meilisearch.yaml#L927
- [ ] Add
-- Code sample explanation For example, in Javascript, the code-samples required to fix the issue are:
client.index('movies').search('big fat liar', { matchingStrategy: 'last' }) and also
client.index('movies').search('big fat liar', { matchingStrategy: 'all' })
so the final version inside of the samples should be:
search_parameter_guide_matching_strategy_1: |-
client.index('movies').search('big fat liar', { matchingStrategy: 'last' })
search_parameter_guide_matching_strategy_2: |-
client.index('movies').search('big fat liar', { matchingStrategy: 'all' })