Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/api/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ Telling "the index is missing" apart from other failures
Redis Search reports an absent index as an ordinary error reply rather than a distinct
type, and the wording has changed between versions -- older releases say ``Unknown index
name``, Redis 8.6 and earlier say ``<name>: no such index``, and Redis 8.8 introduced
``SEARCH_INDEX_NOT_FOUND Index not found: <name>``. There is no error code to branch on,
``SEARCH_INDEX_NOT_FOUND Index not found: <name>``. Valkey Search says
``Index with name '<name>' not found in database <n>``. There is no error code to branch on,
so code that needs to distinguish "missing" from "something went wrong" has to match the
message.

Expand Down
2 changes: 2 additions & 0 deletions redisvl/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def for_svs_vamana(cls, min_redis_version: str):
"no such index",
"search_index_not_found",
"index not found",
# Valkey Search: "Index with name '<name>' not found in database <n>"
"not found in database",
)


Expand Down
4 changes: 3 additions & 1 deletion tests/unit/test_index_exists.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@

# Every wording Redis Search has used for an absent index. 8.8 replaced the
# older prose with an error code, so a match on any single one of these would
# break exists() on some supported server.
# break exists() on some supported server. Valkey Search words it differently
# again, with the index name between "Index" and "not found".
MISSING_INDEX_MESSAGES = [
"Unknown index name",
f"{INDEX_NAME}: no such index",
f"SEARCH_INDEX_NOT_FOUND Index not found: {INDEX_NAME}",
"Index not found",
f"Index with name '{INDEX_NAME}' not found in database 0",
]

# Failures that must never be read as "the index is absent": reporting False
Expand Down