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

Support Match Positions and Formatted Response in Search Queries

Open Sherlouk opened this issue 2 years ago • 0 comments
trafficstars

  • When showMatchesPosition is true, matchPositions should be defined on the returned document

    • All fields (even those not in searchableAttributes) may have locations
    • Swift API should utilise an optional dynamic member lookup or key path subscript based on document members (so, hit[0].matchPositions.title?.count where title is a member on the document). This is to allow for compiler-safe access to attributes.
    • Match positions is an array of objects, each object contains a "start" and "length" both integers measured in bytes and not the number of characters.
  • When attributesToHighlight is not empty, formattedDocument should be defined

    • This will be an instance of T (the document itself), but values may be changed based on search inputs

Solution is reliant on #413 being merged to avoid additional breaking changes.

Sherlouk avatar Sep 24 '23 13:09 Sherlouk