Skip to content

feat(schema): support HNSW reranking in Flex databases (FDE-227) - #861

Draft
vishal-bala wants to merge 4 commits into
mainfrom
feat/flex-hnsw-rerank
Draft

vishal-bala wants to merge 4 commits into
mainfrom
feat/flex-hnsw-rerank

Conversation

@vishal-bala

Copy link
Copy Markdown
Collaborator

Motivation

Creating a disk HNSW index in a Flex database requires an explicit RERANK setting. RedisVL had no way to express that setting in a vector field schema, so it could not generate the required FT.CREATE command. Loading an existing index also lost its reranking setting and any nondefault EF_RUNTIME value reported by Redis.

Changes

Configure reranking per HNSW field

Set rerank: true or rerank: false in the field’s attrs to emit RERANK TRUE or RERANK FALSE. Omitting rerank leaves the option out of FT.CREATE, preserving the command generated for existing schemas. The sync and async index clients share this field builder.

Recover HNSW settings from existing indexes

When FT.INFO reports RERANK or EF_RUNTIME, RedisVL carries those values into the recovered schema. Recreating the index from that schema preserves an explicit false setting and a nondefault search depth.

The README introduces Flex databases alongside the existing Redis deployment options. The schema reference includes a YAML example, and the field attributes guide documents rerank.

Release Notes

You can now set rerank on HNSW vector fields when creating disk indexes in Flex databases. Loading an existing HNSW index preserves rerank and ef_runtime when Redis reports them.

AI Assistance

  • No AI assistance was used for this PR.
  • This PR is AI-assisted. I have reviewed and understood everything in it, and I take responsibility for it.

OpenAI Codex (GPT-6) assisted with implementation, tests, documentation, review and the PR description.

Reviewer Brief

Start here. HNSWVectorField.as_redis_field in redisvl/schema/fields.py controls how both index clients emit RERANK. The unset case preserves the existing wire command. Explicit false must emit RERANK FALSE.

Where it could fail. Check convert_index_info_to_schema in redisvl/redis/connection.py against the target server's FT.INFO reply. RedisVL can recover the rerank setting and nondefault search depth only when the server reports them.

Beyond CI. Five regression cases failed on upstream main at 4ce72d3a. Both affected test files passed on the final branch (82 tests). On ARM64 Redis Software 8.2.6-58.26 with Redis 8.8.0 and Search 8.8.8, both sync and async clients created indexes for each explicit boolean, recovered it with EF_RUNTIME 32, and returned the expected nearest neighbor over RESP2 and RESP3.

Not verified. Cloud Flex, cluster mode, external-provider APIs, and load behavior. Full-tree codespell still flags the existing MessageHistory.acount API and its integration test; commit hooks passed for the review changes.

Reviewed f08959d, review refinements in 20b64b3 · Codex (GPT-6) · lenses: correctness, security, design, tests, docs, Redis behaviour

Since the review. Commit 3d4b5c75 introduces Flex databases in the README and aligns terminology in the schema docs and field docstring. Commit hooks passed.

@codecov-commenter

codecov-commenter commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.01%. Comparing base (4ce72d3) to head (a764c02).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #861      +/-   ##
==========================================
+ Coverage   79.76%   80.01%   +0.24%     
==========================================
  Files         121      121              
  Lines       14852    14854       +2     
  Branches     2599     2601       +2     
==========================================
+ Hits        11847    11885      +38     
+ Misses       2291     2282       -9     
+ Partials      714      687      -27     
Flag Coverage Δ
core 78.76% <100.00%> (+0.02%) ⬆️
service 79.43% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vishal-bala vishal-bala added the auto:minor Increment the minor version when merged label Nov 20, 2026

This branch has not been deployed

No deployments
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants