Skip to content

Conversation

@bsbodden
Copy link
Collaborator

Fixed bug in convert_index_info_to_schema() where only the first prefix was captured from Redis indices with multiple prefixes. Updated code to handle Union[str, List[str]] prefix type by normalizing to first prefix when constructing Redis keys. This maintains backward compatibility while supporting multiple prefixes in schema definition.

  • Added normalization in prefix property (index.py)
  • Normalized prefix in _create_key method (storage.py)
  • Updated key() method to use normalized prefix property

Maintains backward compatibility by converting single-element prefix lists to strings when loading from Redis. This ensures schema comparisons work correctly when comparing existing indices with new configurations.

  • Updated convert_index_info_to_schema to normalize single prefixes
  • Updated unit tests to reflect normalization behavior
  • Fixes schema comparison issues in semantic router and cache extensions

@bsbodden bsbodden force-pushed the bsb/issue-258 branch 2 times, most recently from ec463cc to 481216f Compare September 30, 2025 05:46
Copy link
Contributor

Copilot AI left a 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 bug in SearchIndex.from_existing() where only the first prefix was captured from Redis indices with multiple prefixes. The fix enables proper support for multiple prefixes while maintaining backward compatibility.

  • Fixed prefix extraction in convert_index_info_to_schema() to handle multiple prefixes
  • Added prefix normalization to return first prefix when constructing Redis keys
  • Updated schema definition to support Union[str, List[str]] for prefix type

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
redisvl/schema/schema.py Updated IndexInfo prefix field to accept Union[str, List[str]]
redisvl/redis/connection.py Fixed prefix extraction bug and enhanced vector field parsing
redisvl/index/index.py Added prefix normalization in property getter and key() method
redisvl/index/storage.py Added prefix normalization in _create_key method
tests/unit/test_convert_index_info.py Added comprehensive unit tests for prefix handling scenarios
tests/integration/test_search_index.py Added integration test for multiple prefixes and updated existing test
tests/integration/test_async_search_index.py Updated test to use field-by-field comparison instead of schema equality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

bsbodden and others added 2 commits September 30, 2025 08:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bsbodden bsbodden merged commit c3c1733 into main Sep 30, 2025
37 checks passed
@bsbodden bsbodden deleted the bsb/issue-258 branch September 30, 2025 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants