Failing to retrieve documents once the app is reloads storage context
redis_client = redis.Redis(
host=self.config.get("REDIS_HOST"),
port=self.config.get("REDIS_PORT"),
password=self.config.get("REDIS_PASSWORD"),
ssl=True,
)
docstore = RedisDocumentStore.from_redis_client(
redis_client=redis_client,
namespace=namespace
)
storage_context = StorageContext.from_defaults(
docstore=self.docstore,
index_store=RedisIndexStore.from_redis_client(
redis_client=redis_client,
namespace=namespace
),
)
after this I reload the index from the storage context like below:
base_index = load_index_from_storage(storage_context)
when setting this up and loading the index like after I close my app:
try:
indices = load_indices_from_storage(self.storage_context)
for index in indices:
print(index.index_id)
base_index = load_index_from_storage(storage_context)
print("[INFO] Index found at storage")
except ValueError as e:
print("[INFO] No index found at storage")
base_index = VectorStoreIndex(
nodes=[], storage_context=storage_context)
and the retrieval is defined as:
base_retriever = base_index.as_retriever(
similarity_top_k=self.similarity_top_k
)
retriever = AutoMergingRetriever(
base_retriever, self.storage_context, verbose=True
)
query_bundle = QueryBundle(query_str=query)
retrived_nodes = retriever.retrieve(query_bundle)
this outputs empty retrieved nodes for some reason.