-
Notifications
You must be signed in to change notification settings - Fork 62
fix: (schema) ensure field modifiers follow canonical order for RediSearch parser #434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…earch parser Fix field modifier ordering to satisfy RediSearch parser requirements where INDEXEMPTY and INDEXMISSING must appear BEFORE SORTABLE in field definitions. This resolves index creation failures when using index_missing=True with sortable=True.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a critical RediSearch parser limitation where INDEXEMPTY and INDEXMISSING modifiers must appear before SORTABLE in field definitions. The fix introduces a helper function _normalize_field_modifiers() that reorders field modifiers to match the required canonical order, preventing index creation failures when using index_missing=True with sortable=True.
Key Changes:
- Added
_normalize_field_modifiers()helper function with set-based optimization for reordering field modifiers - Refactored
TextField,TagField,NumericField, andGeoFieldto use the helper function - Added comprehensive unit and integration tests covering various modifier combinations
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
redisvl/schema/fields.py |
Core implementation: Added _normalize_field_modifiers() helper and updated field classes to normalize modifier ordering; includes minor PEP 8 spacing improvement |
tests/unit/test_field_modifier_ordering.py |
Comprehensive unit tests for the helper function and all field types with various modifier combinations |
tests/integration/test_field_modifier_ordering_integration.py |
Integration tests against live Redis to verify index creation succeeds with reordered modifiers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try: | ||
| index.delete(drop=True) | ||
| except Exception: | ||
| pass # Index may not exist if test was skipped or failed early |
Copilot
AI
Nov 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The comment should clarify that this handles cleanup errors, not just test skips. Consider: pass # Cleanup may fail if test was skipped, failed early, or index was already deleted
redisvl/index/index.py
Outdated
| BaseVectorQuery, | ||
| CountQuery, | ||
| FilterQuery, | ||
| TextQuery, |
Copilot
AI
Nov 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The TextQuery import is added but should be grouped with other query imports for better organization. Consider placing it alphabetically with BaseVectorQuery, CountQuery, and FilterQuery on the same line or ensuring consistent multi-line formatting.
bce7e6f to
94e2ff2
Compare
Fix field modifier ordering to satisfy RediSearch parser requirements where
INDEXEMPTY and INDEXMISSING must appear BEFORE SORTABLE in field definitions.
This resolves index creation failures when using index_missing=True with
sortable=True.
Changes:
Fixes: issue #431
Related: Field 'INDEXMISSING' does not have a type error
BREAKING CHANGE: None - backward compatible, only changes internal ordering