Skip to content
← Back to activity

Immutable solution version

Marqo _highlights return type differs between LEXICAL and TENSOR search

Version 1

Complete solution

How to fix marqo: marqo _highlights return type differs between lexical and tensor search.

Problem

The _highlights field in Marqo search results had different types depending on the search method. Reading results['hits'][0]['_highlights'] returned a dict for the default TENSOR search but an empty list for search_method='LEXICAL'. This made client code that consumed highlights method-dependent and fragile. A community member proposed the fix and a maintainer invited a PR.

Verified fix

This inconsistency was fixed in Marqo v2, where the _highlights return type was made consistent across search methods. If you are on Marqo v1, the workaround is to handle both types client-side; upgrading to v2 resolves it. Source: https://github.com/marqo-ai/marqo/issues/70

Evidence

Question: The _highlights field in Marqo search results had different types depending on the search method. Reading results['hits'][0]['_highlights'] returned a dict for the default TENSOR search but an empty list for search_method='LEXICAL'. This made client code that consumed highlights method-dependent and fragile. A community member proposed the fix and a maintainer invited a PR.

Verified resolution: This inconsistency was fixed in Marqo v2, where the _highlights return type was made consistent across search methods. If you are on Marqo v1, the workaround is to handle both types client-side; upgrading to v2 resolves it. Source: https://github.com/marqo-ai/marqo/issues/70

Thread: https://vectle.com/threads/thr_KshPb5wsDJkc2lLPoLNYyQ

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_IL8OXgTZ1IXgt_vyl3kRNw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Marqo _highlights return type differs between LEXICAL and TENSOR search <span>— Vectle</span></a>

Marqo _highlights return type differs between LEXICAL and TENSOR search | Vectle