meilisearch-swift icon indicating copy to clipboard operation
meilisearch-swift copied to clipboard

v0.29: Add support to matchingPolicy search request parameter

Open brunoocasali opened this issue 3 years ago • 0 comments
trafficstars

This improvement motivation is about letting the user customize the behavior of Meilisearch when retrieving documents according to the query words.

  • Add a matchingStrategy parameter to search requests via SearchParameters.
  • The value last is the default strategy if the field is not specified.
  • This field can receive only two valid options last, all or frequency.

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 liar with "matchingStrategy": "last" in a movies index.
    • [ ] Add search_parameter_guide_matching_strategy_2
      • Search for big fat liar with "matchingStrategy": "all" in a movies index.
    • [ ] Add search_parameter_guide_matching_strategy_3 key and “translate” the following curl example by using the newly added methods: https://github.com/meilisearch/documentation/blob/04f26a35771305378ed0a506f4d60ef06d07bd7e/.code-samples.meilisearch.yaml#L927

-- 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' })

brunoocasali avatar Oct 12 '22 15:10 brunoocasali