Skip to content

fix: add missing snippets and indices fields to Highlight types#138

Open
santichausis wants to merge 1 commit into
typesense:masterfrom
santichausis:fix/highlight-types
Open

fix: add missing snippets and indices fields to Highlight types#138
santichausis wants to merge 1 commit into
typesense:masterfrom
santichausis:fix/highlight-types

Conversation

@santichausis

Copy link
Copy Markdown

Summary

  • The Typesense API returns different highlight shapes for singular vs array fields.
  • For array fields (e.g. string[]), the response includes snippets (list of strings), indices (list of matched array positions), and matched_tokens as a list of lists.
  • These fields were missing from the Highlight and HighlightExtended TypedDicts.
  • Changed Highlight to total=False since not all fields are present in every response (singular fields have snippet/value, array fields have snippets/indices).

Closes #129

Test plan

  • mypy passes with no issues
  • ruff check passes
  • No runtime changes, type annotation only
The Typesense API returns different highlight shapes for singular vs
array fields. For array fields (e.g. string[]), the response includes
snippets (list of strings), indices (list of matched array positions),
and matched_tokens as a list of lists. These fields were missing from
the Highlight and HighlightExtended TypedDicts.

Changed Highlight to total=False since not all fields are present in
every response (singular fields have snippet/value, array fields have
snippets/indices).

Closes typesense#129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants