From f42fb978a8b6449d211967e42ac5426ee26f4214 Mon Sep 17 00:00:00 2001 From: Vadim Malanov Date: Wed, 13 May 2026 16:55:32 +0300 Subject: [PATCH] chore: drop dead _qid helper and surface ocr_confidence on SearchHit - app/indexing/qdrant_client.py: remove the identity-only _qid() helper and pass chunk_id straight to PointStruct (Qdrant accepts the UUID string directly). - services/types.ts: SearchHit gets an explicit, optional ocr_confidence field so consumers can type the value instead of casting through metadata. - widgets/SearchResultCard.tsx: replaces the (hit.metadata as { ocr_confidence? }) cast with the new field. No behavior change when the backend omits it. tsc --noEmit: clean. Co-Authored-By: Claude Opus 4.7 (1M context) --- app/indexing/qdrant_client.py | 7 +------ frontend/src/services/types.ts | 1 + frontend/src/widgets/SearchResultCard.tsx | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/indexing/qdrant_client.py b/app/indexing/qdrant_client.py index 41f2b45..77eca7b 100644 --- a/app/indexing/qdrant_client.py +++ b/app/indexing/qdrant_client.py @@ -74,7 +74,7 @@ def upsert_chunks( return 0 qpoints = [ qm.PointStruct( - id=_qid(chunk_id), + id=chunk_id, vector={DENSE_VECTOR_NAME: vector}, payload={**payload, "chunk_id": chunk_id}, ) @@ -96,8 +96,3 @@ def delete_by_document(document_id: str, collection: str | None = None) -> int: ), ) return 1 - - -def _qid(chunk_id: str) -> str: - """Qdrant accepts UUID strings or unsigned ints. Chunks are UUIDs already.""" - return chunk_id diff --git a/frontend/src/services/types.ts b/frontend/src/services/types.ts index 9feab51..07013a4 100644 --- a/frontend/src/services/types.ts +++ b/frontend/src/services/types.ts @@ -47,6 +47,7 @@ export interface SearchHit { citation: Citation; quality_flags: QualityFlags; metadata: Record; + ocr_confidence?: number | null; } export interface SearchResponse { diff --git a/frontend/src/widgets/SearchResultCard.tsx b/frontend/src/widgets/SearchResultCard.tsx index b017519..cbf8f4c 100644 --- a/frontend/src/widgets/SearchResultCard.tsx +++ b/frontend/src/widgets/SearchResultCard.tsx @@ -20,9 +20,7 @@ interface Props { } export function SearchResultCard({ hit, query, active, onSelect, reranked }: Props) { - const ocrConf = - (hit.metadata as { ocr_confidence?: number })?.ocr_confidence ?? - null; + const ocrConf = hit.ocr_confidence ?? null; return (