Expose only completed files as RAG evidence
Expose only completed files as RAG evidence
File upload and search availability are different states. Only a search copy that finished parsing, embedding, and storage—and has processed = TRUE—may become evidence for a user answer.
Both vector similarity and trigram search must check the completion predicate inside the file join. Latest-version selection must not mix a processing new edition with a ready old one. Nullable joins such as HIRA ebooks and QA pairs need partial indexes that match their actual OR paths.
... JOIN vector_files f ON f.id = e.vector_file_id
WHERE f.store_id = $1
AND f.processed = TRUE;
Show processing and retryability in Admin instead of hiding failed files as an empty result. Preserve owner scope, source, model, and dimension so re-embedding and reconciliation are possible. A completion partial index can shrink the hot path, but verify it with staging EXPLAIN (ANALYZE, BUFFERS) before production.
Related course: AI providers and RAG boundaries