Skip to content

Commit 90bd3af

Browse files
committed
fixing type issues
1 parent 040d37b commit 90bd3af

1 file changed

Lines changed: 18 additions & 19 deletions

File tree

  • integrations/qdrant/src/haystack_integrations/document_stores/qdrant

integrations/qdrant/src/haystack_integrations/document_stores/qdrant/document_store.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ def delete_all_documents(self, recreate_index: bool = False) -> None:
542542
sparse_vectors = info_json["config"]["params"]["sparse_vectors"]
543543
use_sparse_embeddings = sparse_vectors if sparse_vectors else False
544544

545+
# deal with the Optional sparse_idf
545546
hnsw_config = info_json["config"]["params"]["vectors"].get("config", {}).get("hnsw_config", None)
546547
sparse_idf = hnsw_config if use_sparse_embeddings and hnsw_config else False
547548

@@ -550,30 +551,28 @@ def delete_all_documents(self, recreate_index: bool = False) -> None:
550551
collection_name=self.index,
551552
embedding_dim=info_json["config"]["params"]["vectors"]["size"],
552553
recreate_collection=True,
553-
similarity=info_json["config"]["params"]["vectors"]["distance"],
554+
similarity=info_json["config"]["params"]["vectors"]["distance"].lower(),
554555
use_sparse_embeddings=use_sparse_embeddings,
555556
sparse_idf=sparse_idf,
556557
on_disk=info_json["config"]["hnsw_config"]["on_disk"],
557-
# ToDo: investigate
558-
# - CollectionInfo has payload_schema as Optional[Dict[str, PayloadSchemaType]],
559-
# - self._set_up_collection expects Optional[List[dict]]
560-
payload_fields_to_index=None,
558+
payload_fields_to_index=info_json["payload_schema"],
561559
)
562560

563-
try:
564-
self._client.delete(
565-
collection_name=self.index,
566-
points_selector=rest.FilterSelector(
567-
filter=rest.Filter(
568-
must=[],
569-
)
570-
),
571-
wait=self.wait_result_from_api,
572-
)
573-
except Exception as e:
574-
logger.warning(
575-
f"Error {e} when calling QdrantDocumentStore.delete_all_documents()",
576-
)
561+
else:
562+
try:
563+
self._client.delete(
564+
collection_name=self.index,
565+
points_selector=rest.FilterSelector(
566+
filter=rest.Filter(
567+
must=[],
568+
)
569+
),
570+
wait=self.wait_result_from_api,
571+
)
572+
except Exception as e:
573+
logger.warning(
574+
f"Error {e} when calling QdrantDocumentStore.delete_all_documents()",
575+
)
577576

578577
@classmethod
579578
def from_dict(cls, data: Dict[str, Any]) -> "QdrantDocumentStore":

0 commit comments

Comments
 (0)