diff --git a/docs/api/exceptions.rst b/docs/api/exceptions.rst index 8fb5fb53..9c692c11 100644 --- a/docs/api/exceptions.rst +++ b/docs/api/exceptions.rst @@ -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 ``: no such index``, and Redis 8.8 introduced -``SEARCH_INDEX_NOT_FOUND Index not found: ``. There is no error code to branch on, +``SEARCH_INDEX_NOT_FOUND Index not found: ``. Valkey Search says +``Index with name '' not found in database ``. There is no error code to branch on, so code that needs to distinguish "missing" from "something went wrong" has to match the message. diff --git a/redisvl/exceptions.py b/redisvl/exceptions.py index c110934d..aa543d43 100644 --- a/redisvl/exceptions.py +++ b/redisvl/exceptions.py @@ -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 '' not found in database " + "not found in database", ) diff --git a/tests/unit/test_index_exists.py b/tests/unit/test_index_exists.py index 25469ab3..efe79eb3 100644 --- a/tests/unit/test_index_exists.py +++ b/tests/unit/test_index_exists.py @@ -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