Persist Qdrant to host: bind-mount ./data/qdrant; add data dir ignore; update docs

This commit is contained in:
2026-03-23 19:52:43 +01:00
parent 8f758cf3b5
commit b8c44bd1b2
8 changed files with 264 additions and 48 deletions

View File

@@ -147,6 +147,10 @@ def _build_filter(metadata: Dict[str, Any]) -> Optional[Filter]:
return Filter(must=conditions)
def _id_filter(original_id: str) -> Filter:
return Filter(must=[FieldCondition(key="_original_id", match=MatchValue(value=original_id))])
def _point_id(raw: Optional[str]) -> str:
"""Return a Qdrant-compatible point id.
@@ -408,3 +412,29 @@ def get_point(point_id: str, collection: Optional[str] = None):
raise
except Exception as e:
raise HTTPException(404, str(e))
@app.get("/points/by-original-id/{original_id}")
def get_point_by_original_id(original_id: str, collection: Optional[str] = None):
col = _col(collection)
try:
points, _ = client.scroll(
collection_name=col,
scroll_filter=_id_filter(original_id),
limit=1,
with_vectors=True,
with_payload=True,
)
if not points:
raise HTTPException(404, f"Point with _original_id '{original_id}' not found")
point = points[0]
return {
"id": point.id,
"vector": point.vector,
"metadata": point.payload,
"collection": col,
}
except HTTPException:
raise
except Exception as e:
raise HTTPException(404, str(e))