feat: FT.HYBRID support via hybrid_vector_search()#37
Merged
Conversation
Translate hybrid_vector_search(cosine_distance(...), fulltext(...), rrf()|linear()) into a native FT.HYBRID command (Redis 8.4+), fusing a text query and a vector query server-side with RRF or LINEAR fusion. Adds support across the parser, analyzer, translator, and executor layers, a Redis 8.4 version guard, and FT.INFO / hybrid-reply parsing that handles both the RESP2 list and redis-py 8.x RESP3 map shapes. Bumps the test Redis image to 8.4. Jira: RAAE-1322
Contributor
|
🚀 PR was released in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
FT.HYBRID(server-side text + vector fusion, Redis 8.4+) to the SQL translator via a newhybrid_vector_search()SELECT function, alongside the existingFT.SEARCH/FT.AGGREGATEtargets.Both legs reuse the functions the package already exposes (
cosine_distance/vector_distance/vector_rangeandfulltext); the third argument selects RRF or LINEAR fusion. The options mirror RedisVL's nativeHybridQuery. Spec:docs/proposals/ft-hybrid.md.What changed
HybridSearchSpec+hybrid_vector_search()detection (composes the nested leg/fusion functions; full validation).HybridSearchAnalysis; resolves leg field types (text leg TEXT, vector leg VECTOR), derives KNNKfromLIMIT.FT.HYBRIDcommand path (SEARCH ... VSIM ... COMBINE ...,LOAD,LIMIT,PARAMS). Empirically verified againstredis:8.4: KNN/RANGE precedesFILTER,LOADfields are@-prefixed, and noDIALECTargument (FT.HYBRID rejects it).PARAMSvalue (the VSIM$vectorstays a parameter reference); clear Redis 8.4 version guard.FT.INFOand the hybrid reply are parsed for both the RESP2 list shape and the redis-py 8.x RESP3 map shape.tests/test_ft_hybrid.py(parser/analyzer/translator/executor + integration on realFT.HYBRID) and dict-reply schema tests. Test Redis image bumped 8.0.2 -> 8.4.Notes
constant/window, LINEARalphaonly (beta derived as1 - alpha, matchingHybridQuery), KNNef_runtime, RANGEradius/epsilon.alphaonly by design; an explicitbetais deferred.SQLQuerytests + user-guide example are tracked separately (RAAE-1322).Jira: RAAE-1322