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) <noreply@anthropic.com>
This commit is contained in:
Vadim Malanov
2026-05-13 16:55:32 +03:00
parent 785d3be970
commit f42fb978a8
3 changed files with 3 additions and 9 deletions

View File

@@ -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

View File

@@ -47,6 +47,7 @@ export interface SearchHit {
citation: Citation;
quality_flags: QualityFlags;
metadata: Record<string, unknown>;
ocr_confidence?: number | null;
}
export interface SearchResponse {

View File

@@ -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 (
<motion.button
layout