-
Notifications
You must be signed in to change notification settings - Fork 59
feat: add native support for UNF and NOINDEX field attributes #386
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
Conversation
Implements native support for Redis field attributes UNF (un-normalized form) and NOINDEX to provide more control over field indexing and sorting behavior. BREAKING CHANGE: None - all changes are backward compatible with default values - Add `no_index` attribute to BaseFieldAttributes for all field types - Add `unf` attribute to TextFieldAttributes and NumericFieldAttributes - Both attributes default to False maintaining backward compatibility Field Support: - TextField: Supports both no_index and unf attributes - NumericField: Supports both no_index and unf attributes - TagField: Supports no_index attribute - GeoField: Supports no_index attribute Technical Implementation: - NOINDEX implemented via redis-py's native no_index parameter - UNF added via args_suffix manipulation with proper ordering - Both attributes require sortable=True to take effect - Special parsing logic handles Redis auto-adding UNF to sortable numeric fields Fixes #374
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 implements native support for Redis field attributes UNF (un-normalized form) and NOINDEX, providing better control over field indexing and sorting behavior in Redis search indices.
- Adds
no_indexattribute to BaseFieldAttributes andunfattribute to TextFieldAttributes and NumericFieldAttributes with default values of False - Implements proper Redis command generation for both attributes with correct ordering (UNF before NOINDEX)
- Updates schema parsing to handle these attributes when loading existing indices from Redis
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/unit/test_unf_noindex_fields.py | Comprehensive unit tests covering all field types with new attributes |
| tests/integration/test_unf_noindex_integration.py | Integration tests validating real Redis behavior with NOINDEX and UNF |
| redisvl/schema/fields.py | Core implementation adding attributes and Redis field generation logic |
| redisvl/redis/connection.py | Schema parsing logic to handle UNF/NOINDEX when loading existing indices |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or 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.
Looks good!
Add support for UNF (un-normalized form) and NOINDEX attributes for schema field classes, following Python RedisVL PR #386. Features: - TextField: Add UNF support via Jedis sortableUNF() - NumericField: Add UNF flag (stored but limited by Jedis) - NOINDEX: Already supported via indexed=false - Comprehensive unit tests (16 tests) - Maintains backward compatibility Key behaviors: - UNF only applies when sortable=true - UNF preserves original character case for sorting - NOINDEX prevents indexing, field still sortable/retrievable - TextField & NumericField support both UNF and NOINDEX - TagField & GeoField support NOINDEX only Limitations: - Jedis NumericField doesn't have sortableUNF() yet - Filed TODO to request Jedis enhancement Python Reference: redis/redis-vl-python#386 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add support for UNF (un-normalized form) and NOINDEX attributes for schema field classes, following Python RedisVL PR #386. Features: - TextField: Add UNF support via Jedis sortableUNF() - NumericField: Add UNF flag (stored but limited by Jedis) - NOINDEX: Already supported via indexed=false - Comprehensive unit tests (16 tests) - Maintains backward compatibility Key behaviors: - UNF only applies when sortable=true - UNF preserves original character case for sorting - NOINDEX prevents indexing, field still sortable/retrievable - TextField & NumericField support both UNF and NOINDEX - TagField & GeoField support NOINDEX only Limitations: - Jedis NumericField doesn't have sortableUNF() yet - Filed TODO to request Jedis enhancement Python Reference: redis/redis-vl-python#386
Add support for UNF (un-normalized form) and NOINDEX attributes for schema field classes, following Python RedisVL PR #386. Features: - TextField: Add UNF support via Jedis sortableUNF() - NumericField: Add UNF flag (stored but limited by Jedis) - NOINDEX: Already supported via indexed=false - Comprehensive unit tests (16 tests) - Maintains backward compatibility Key behaviors: - UNF only applies when sortable=true - UNF preserves original character case for sorting - NOINDEX prevents indexing, field still sortable/retrievable - TextField & NumericField support both UNF and NOINDEX - TagField & GeoField support NOINDEX only Limitations: - Jedis NumericField doesn't have sortableUNF() yet - Filed TODO to request Jedis enhancement Python Reference: redis/redis-vl-python#386
Implements native support for Redis field attributes UNF (un-normalized form) and NOINDEX to provide more control over field indexing and sorting behavior.
BREAKING CHANGE: None - all changes are backward compatible with default values
no_indexattribute to BaseFieldAttributes for all field typesunfattribute to TextFieldAttributes and NumericFieldAttributesField Support:
Technical Implementation:
Fixes #374