Return empty list if archival memory search over empty local index (#402)

This commit is contained in:
Sarah Wooders
2023-11-09 14:49:23 -08:00
committed by GitHub
parent b17a8e89fb
commit 01adfaa4be

View File

@@ -111,6 +111,8 @@ class LocalStorageConnector(StorageConnector):
), f"expected {orig_size + len(passages)} nodes, got {len(self.get_nodes())} nodes"
def query(self, query: str, query_vec: List[float], top_k: int = 10) -> List[Passage]:
if isinstance(self.index, EmptyIndex): # empty index
return []
# TODO: this may be super slow?
# the nice thing about creating this here is that now we can save the persistent storage manager
retriever = VectorIndexRetriever(