Skip to content

autocomplete highlighting type errors when handling fields with non-primitive values #1417

@jezzzm

Description

@jezzzm

Description

  • meili server currently does not only return _highlightResult keys for just those specified via the attributesToHighlight search parameter
  • this means data that should not even be attempted to be highlighted is still returned.
    • e.g. an array of images under the images key with objects of type {url:string; size: number; h:number; w: number; alt: string}
    • these non-primitive fields are not returned with a value field which is required for highlighting -- see image
Image
  • in lieu of (what I imagine is) a larger change, i suggest there be some defensive checks in the autocomplete highlight parsing for the existence of a valid value key in each of the returned _highlightResults

NB. this is touched on in a related issue: #1337 (comment)

Expected behavior

  1. not all attributes returned in highlightResult - only those specified via attributesToHighlight
  2. the autocomplete frontend parsing to not typeerror when the value key doesn't exist for an attribute highlight result.

Current behavior
autocomplete typeerrors

Screenshots or Logs
If applicable, add screenshots or logs to help explain your problem.

Environment (please complete the following information):

  • OS: Mac 15.6
  • Browser: Chrome 140
  • Meilisearch version: latest
  • instant-meilisearch version: latest
  • instantsearch.js version: 4.77.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions