diff --git a/knowledge-graph-api/storage/redis_vector.py b/knowledge-graph-api/storage/redis_vector.py index 6332598..f2e90a6 100644 --- a/knowledge-graph-api/storage/redis_vector.py +++ b/knowledge-graph-api/storage/redis_vector.py @@ -17,9 +17,17 @@ class RedisVectorStore: """Async Redis vector store backed by RedisSearch.""" def __init__(self) -> None: + # Force RESP2 protocol. Redis Stack 7.2+ negotiates RESP3 by + # default, which makes the server reply to FT.SEARCH with a + # dict (``{b'total_results': N, b'results': [...]}``). The + # redis-py ``ft().search()`` helper still parses RESP2 list + # shape, so on RESP3 it silently returns ``total=0, docs=[]`` + # for queries that DO match. Pinning protocol=2 makes the + # response a positional list and search results decode correctly. self._client = aioredis.from_url( settings.REDIS_URL, decode_responses=False, + protocol=2, ) self._index_name = settings.REDIS_INDEX_NAME