From 40d915c4c4de9ae780662b3d8e538e209e6afeed Mon Sep 17 00:00:00 2001 From: Lars Date: Fri, 5 Sep 2025 07:15:20 +0200 Subject: [PATCH] scripts/reset_qdrant.py aktualisiert --- scripts/reset_qdrant.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/reset_qdrant.py b/scripts/reset_qdrant.py index 131e1d8..4a04daa 100644 --- a/scripts/reset_qdrant.py +++ b/scripts/reset_qdrant.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ Name: scripts/reset_qdrant.py -Version: v1.1.0 (2025-09-04) +Version: v1.1.1 (2025-09-05) Kurzbeschreibung: Sicheres Zurücksetzen der Qdrant-Collections für EIN Projektpräfix. Das Skript ermittelt zunächst die tatsächlich betroffenen Collections und zeigt eine @@ -86,9 +86,21 @@ def confirm_or_abort(action: str, collections: List[str], nonexisting: List[str] def delete_all_points(client: QdrantClient, collections: List[str]) -> None: + """Löscht *alle* Points in den angegebenen Collections. + API-Kompatibilität: + - neuere qdrant-client: client.delete_points(...) + - ältere qdrant-client: client.delete(...) + """ match_all = rest.Filter(must=[]) for col in collections: - client.delete_points(collection_name=col, points_selector=match_all, wait=True) + try: + if hasattr(client, "delete_points"): + client.delete_points(collection_name=col, points_selector=match_all, wait=True) + else: + client.delete(collection_name=col, points_selector=match_all, wait=True) + except Exception as e: + print(f"Fehler beim Löschen der Points in {col}: {e}", file=sys.stderr) + raise def wipe_collections(client: QdrantClient, all_col_names: List[str], existing: List[str]) -> None: