-
Notifications
You must be signed in to change notification settings - Fork 66
Multiprefix/test #471
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?
Multiprefix/test #471
Changes from all commits
cd11eec
5dbdc05
d555f8c
1c5dcdb
3ee26e2
b0dc8ab
41e14a1
7f3f5ff
2f118f7
ff5fedd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,140 @@ | ||||||||
| """ | ||||||||
| Example: Multi-prefix index workaround | ||||||||
|
|
||||||||
| This script demonstrates how to: | ||||||||
| 1. Manually create a multi-prefix index using execute_command | ||||||||
| 2. Connect to it using SearchIndex.from_existing() | ||||||||
| 3. Load data with different prefixes using the keys parameter | ||||||||
| 4. Query and verify results come from both prefixes | ||||||||
| """ | ||||||||
|
|
||||||||
| import redis | ||||||||
| from redisvl.index import SearchIndex | ||||||||
| from redisvl.query import VectorQuery | ||||||||
| from redisvl.redis.utils import array_to_buffer | ||||||||
|
|
||||||||
| # Connect to Redis | ||||||||
| client = redis.Redis(host="localhost", port=6379, decode_responses=True) | ||||||||
|
|
||||||||
| INDEX_NAME = "user_simple" | ||||||||
|
|
||||||||
| # Clean up any existing index | ||||||||
| try: | ||||||||
| client.ft(INDEX_NAME).dropindex(delete_documents=True) | ||||||||
| except Exception: | ||||||||
|
||||||||
| except Exception: | |
| except Exception: | |
| # The index may not exist yet or may have been removed already; ignore drop errors. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||
| [project] | ||||||
| name = "redisvl" | ||||||
| version = "0.13.2" | ||||||
| version = "0.14.0" | ||||||
| description = "Python client library and CLI for using Redis as a vector database" | ||||||
| authors = [{ name = "Redis Inc.", email = "applied.ai@redis.com" }] | ||||||
| requires-python = ">=3.9.2,<3.14" | ||||||
|
|
@@ -51,6 +51,9 @@ bedrock = [ | |||||
| pillow = [ | ||||||
| "pillow>=11.3.0", | ||||||
| ] | ||||||
| sql-redis = [ | ||||||
| "sql-redis>=0.1.2", | ||||||
| ] | ||||||
|
|
||||||
| [project.urls] | ||||||
| Homepage = "https://github.com/redis/redis-vl-python" | ||||||
|
|
@@ -64,6 +67,9 @@ rvl = "redisvl.cli.runner:main" | |||||
| requires = ["hatchling"] | ||||||
| build-backend = "hatchling.build" | ||||||
|
|
||||||
| [tool.hatch.metadata] | ||||||
| allow-direct-references = true | ||||||
|
|
||||||
|
Comment on lines
+70
to
+72
|
||||||
| [tool.hatch.metadata] | |
| allow-direct-references = 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.
The title "Multi-prefix index workaround" (line 2) is misleading now that multi-prefix support has been added to the SearchIndex.create() method (as shown in redisvl/index/index.py lines 648-653). The example still manually creates the index using execute_command, which is no longer necessary. Either:
The current title suggests this is a workaround for missing functionality, which is no longer accurate.