Repository navigation
fix(schema): emit INDEXMISSING after the vector attribute block - #771
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
A vector field with index_missing=True put INDEXMISSING into the
algorithm attribute dict, so create() failed with "Invalid input of
type: 'bool'", and the server rejects the token inside the attribute
block anyway ("Bad arguments for algorithm"). Pass index_missing to the
redis-py VectorField instead, which appends INDEXMISSING after the block
as FT.CREATE expects.
Collaborator
|
Hi, thanks for your contribution! Can you rebase onto the latest |
This branch has not been deployed
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.
What
Vector fields now pass
index_missingto the redis-pyVectorFieldconstructor instead of addingINDEXMISSINGto the algorithm attribute dict.Why
With
index_missing: Trueon a vector field,SearchIndex.create()fails.field_dataput"INDEXMISSING": Trueinside the attribute block, so the client raisesInvalid input of type: 'bool', and the server rejects the token there anyway (Bad arguments for algorithm HNSW: INDEXMISSING).FT.CREATEexpectsINDEXMISSINGafter the block, which is where redis-py places it for theindex_missingkeyword. The review on #742 described this failure.Fixes #770.
Changes
redisvl/schema/fields.py: dropINDEXMISSINGfromBaseVectorFieldAttributes.field_data, and passindex_missing=self.attrs.index_missinginFlatVectorField,HNSWVectorFieldandSVSVectorField.as_redis_field().tests/unit/test_fields.py: replace the test that assertedINDEXMISSINGinfield_datawith a parametrized test (FLAT, HNSW, SVS-VAMANA) that checksINDEXMISSINGfollows the attribute block inredis_args().tests/integration/test_field_modifier_ordering_integration.py: create FLAT and HNSW indexes with a vectorindex_missingfield and check thatismissing(@embedding)returns only the document without the vector.from_existingstill does not recoverindex_missingon vector fields (see the comment intests/unit/test_convert_index_info.py). That can follow separately now that the field can be recreated.Testing
main, the 5 new test cases fail (DataError: Invalid input of type: 'bool'for the integration cases). With this change,tests/unit/test_fields.pyandtests/integration/test_field_modifier_ordering_integration.pygive 72 passed againstredis:8.4.tests/unit(withouttest_mcp) gives the same result as onmain, apart from the 2 added cases. The only failures are the existingtest_reprandgoogle_genaioptional-dependency ones.black,isortandmypy redisvlpass.Note
Medium Risk
Touches vector index schema serialization for all algorithms; wrong ordering would break index creation, but behavior is narrowly scoped to the
index_missingflag with added regression tests.Overview
Vector
index_missingnow emitsINDEXMISSINGin the correct place forFT.CREATE, so indexes with missing-vector search can be created again.Previously
INDEXMISSINGwas stuffed into the vector algorithm attribute dict (field_data), which broke redis-py (Invalid input of type: 'bool') and Redis (Bad arguments for algorithm …: INDEXMISSING). The change removes it fromBaseVectorFieldAttributes.field_dataand passesindex_missinginto the redis-pyVectorFieldconstructor for FLAT, HNSW, and SVS-VAMANA, matching how lexical fields handle the modifier (token after the attribute block).Tests were updated: a parametrized unit test asserts
INDEXMISSINGis not inside the counted attribute block but appears inredis_args()suffix; integration tests cover FLAT/HNSW indexes andismissing(@embedding)queries.Reviewed by Cursor Bugbot for commit 723e8b1. Bugbot is set up for automated code reviews on this repo. Configure here.