You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix RESP3 map parsing for FT.SEARCH/AGGREGATE/INFO (#570) (#571)
Newer StackExchange.Redis versions auto-negotiate RESP3, which changes
FT.SEARCH/FT.AGGREGATE/FT.INFO replies from the flat RESP2 array into a
map. SE.Redis collapses a map's Resp2Type to Array (flattened key/value
pairs), so the existing parsers read the first map key as the document
count, throwing "InvalidCastException: Could not cast to long".
Detect the RESP3 map shape at the parser layer and reshape it back into
the legacy RESP2 layout before the existing logic runs:
- RedisReply records IsMap (Resp3Type == Map) and exposes
GetMapValueOrDefault; the existing flattening is preserved.
- SearchResponse.NormalizeReply and AggregationResult.NormalizeReply
reshape map replies into the legacy [count, id, (score,) fields, ...]
array (search) and [count, fields, ...] array (aggregation).
- RedisIndexInfoAttribute flattens RESP3's nested "flags" array so
SORTABLE/NOSTEM/INDEXMISSING/INDEXEMPTY are detected under both
protocols.
- RedisUriParser honors a "protocol" URI query arg and the
REDIS_OM_PROTOCOL env var (resp2/resp3), giving users a workaround and
enabling the full suite to run under RESP3.
Adds deterministic unit tests that feed synthetic RESP3 maps through the
search and aggregation parsers (CI runs RESP2 by default).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments