Skip to content

feat: FT.HYBRID support via hybrid_vector_search()#37

Merged
rbs333 merged 2 commits into
mainfrom
feat/RAAE-1322/hybrid_support
Jun 24, 2026
Merged

feat: FT.HYBRID support via hybrid_vector_search()#37
rbs333 merged 2 commits into
mainfrom
feat/RAAE-1322/hybrid_support

Conversation

@rbs333

@rbs333 rbs333 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds FT.HYBRID (server-side text + vector fusion, Redis 8.4+) to the SQL translator via a new hybrid_vector_search() SELECT function, alongside the existing FT.SEARCH / FT.AGGREGATE targets.

SELECT user, job, job_description,
       hybrid_vector_search(
           cosine_distance(job_embedding, :vec),   -- VSIM leg
           fulltext(job_description, 'principles'), -- SEARCH leg
           rrf()                                    -- COMBINE (or linear(alpha => 0.3))
       ) AS hybrid_score
FROM user_simple
WHERE region = 'us-central'                         -- per-leg FILTER
ORDER BY hybrid_score DESC
LIMIT 10

Both legs reuse the functions the package already exposes (cosine_distance / vector_distance / vector_range and fulltext); the third argument selects RRF or LINEAR fusion. The options mirror RedisVL's native HybridQuery. Spec: docs/proposals/ft-hybrid.md.

What changed

  • Parser: HybridSearchSpec + hybrid_vector_search() detection (composes the nested leg/fusion functions; full validation).
  • Analyzer: HybridSearchAnalysis; resolves leg field types (text leg TEXT, vector leg VECTOR), derives KNN K from LIMIT.
  • Translator: new FT.HYBRID command path (SEARCH ... VSIM ... COMBINE ..., LOAD, LIMIT, PARAMS). Empirically verified against redis:8.4: KNN/RANGE precedes FILTER, LOAD fields are @-prefixed, and no DIALECT argument (FT.HYBRID rejects it).
  • Executor: runs and parses the hybrid reply; vector bytes are injected only into the PARAMS value (the VSIM $vector stays a parameter reference); clear Redis 8.4 version guard.
  • redis-py 8.x compatibility: FT.INFO and the hybrid reply are parsed for both the RESP2 list shape and the redis-py 8.x RESP3 map shape.
  • Tests: tests/test_ft_hybrid.py (parser/analyzer/translator/executor + integration on real FT.HYBRID) and dict-reply schema tests. Test Redis image bumped 8.0.2 -> 8.4.

Notes

  • Fusion config: RRF constant/window, LINEAR alpha only (beta derived as 1 - alpha, matching HybridQuery), KNN ef_runtime, RANGE radius/epsilon.
  • LINEAR exposes alpha only by design; an explicit beta is deferred.
  • Companion RedisVL SQLQuery tests + user-guide example are tracked separately (RAAE-1322).

Jira: RAAE-1322

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
@rbs333 rbs333 requested a review from nkanu17 June 24, 2026 13:50
@rbs333 rbs333 added the auto:release Create a release when this PR is merged label Jun 24, 2026
@rbs333 rbs333 merged commit a19ae1c into main Jun 24, 2026
8 checks passed
@rbs333 rbs333 deleted the feat/RAAE-1322/hybrid_support branch June 24, 2026 17:46
@github-actions

Copy link
Copy Markdown
Contributor

🚀 PR was released in v0.7.0 🚀

@github-actions github-actions Bot added the released This issue/pull request has been released. label Jun 24, 2026
@rbs333 rbs333 added the auto:minor Increment the minor version when merged label Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto:minor Increment the minor version when merged auto:release Create a release when this PR is merged released This issue/pull request has been released.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant