From 255d0b013be6585631dea6460556b429130b3247 Mon Sep 17 00:00:00 2001 From: Nikhiladiga Date: Sun, 10 May 2026 19:38:53 +0530 Subject: [PATCH] [FIX]: update Highlight type definition to support array fields and optional attributes --- src/typesense/types/document.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/typesense/types/document.py b/src/typesense/types/document.py index 496432d..439d560 100644 --- a/src/typesense/types/document.py +++ b/src/typesense/types/document.py @@ -727,14 +727,18 @@ class Highlight(typing.TypedDict): Schema for highlighting search results. Attributes: - matched_tokens (list[str]): List of matched tokens. + matched_tokens (list[str] | list[list[str]]): List of matched tokens. snippet (str): Snippet of the matched tokens. + snippets (list[str]): Snippets of the matched tokens (for array fields). + indices (list[int]): Indices of the matched tokens (for array fields). value (str): Value of the matched tokens. """ - matched_tokens: typing.List[str] - snippet: str - value: str + matched_tokens: typing.Union[typing.List[str], typing.List[typing.List[str]]] + snippet: typing.NotRequired[str] + snippets: typing.NotRequired[typing.List[str]] + indices: typing.NotRequired[typing.List[int]] + value: typing.NotRequired[str] class HighlightExtended(Highlight):