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:
@@ -74,7 +74,7 @@ def upsert_chunks(
|
|||||||
return 0
|
return 0
|
||||||
qpoints = [
|
qpoints = [
|
||||||
qm.PointStruct(
|
qm.PointStruct(
|
||||||
id=_qid(chunk_id),
|
id=chunk_id,
|
||||||
vector={DENSE_VECTOR_NAME: vector},
|
vector={DENSE_VECTOR_NAME: vector},
|
||||||
payload={**payload, "chunk_id": chunk_id},
|
payload={**payload, "chunk_id": chunk_id},
|
||||||
)
|
)
|
||||||
@@ -96,8 +96,3 @@ def delete_by_document(document_id: str, collection: str | None = None) -> int:
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
def _qid(chunk_id: str) -> str:
|
|
||||||
"""Qdrant accepts UUID strings or unsigned ints. Chunks are UUIDs already."""
|
|
||||||
return chunk_id
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ export interface SearchHit {
|
|||||||
citation: Citation;
|
citation: Citation;
|
||||||
quality_flags: QualityFlags;
|
quality_flags: QualityFlags;
|
||||||
metadata: Record<string, unknown>;
|
metadata: Record<string, unknown>;
|
||||||
|
ocr_confidence?: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchResponse {
|
export interface SearchResponse {
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function SearchResultCard({ hit, query, active, onSelect, reranked }: Props) {
|
export function SearchResultCard({ hit, query, active, onSelect, reranked }: Props) {
|
||||||
const ocrConf =
|
const ocrConf = hit.ocr_confidence ?? null;
|
||||||
(hit.metadata as { ocr_confidence?: number })?.ocr_confidence ??
|
|
||||||
null;
|
|
||||||
return (
|
return (
|
||||||
<motion.button
|
<motion.button
|
||||||
layout
|
layout
|
||||||
|
|||||||
Reference in New Issue
Block a user