async fn replace_chunks(
pool: &SqlitePool,
document_id: &str,
chunks: &[Chunk],
) -> Result<()>Expand description
Atomically replaces all chunks (and their embeddings/FTS entries) for a document.
This function runs inside a single SQLite transaction to ensure consistency:
- Deletes old
chunk_vectorsrows for the document’s chunks. - Deletes old
embeddingsmetadata rows for the document’s chunks. - Deletes old
chunks_fts(FTS5) entries for the document. - Deletes old
chunksrows for the document. - Inserts new chunks and their corresponding FTS entries.
§Arguments
pool— the database connection pool.document_id— the UUID of the parent document.chunks— the new set of chunks to insert.