Skip to main content

store_documents_batch

Function store_documents_batch 

Source
pub async fn store_documents_batch(
    engine: &MemexEngine,
    items: Vec<StoreItem>,
) -> Result<BatchResult>
Expand description

Batch store multiple documents efficiently.

More efficient than calling store_document() multiple times as embeddings are generated in batches.

§Arguments

  • engine - The MemexEngine instance
  • items - Vector of items to store

§Returns

BatchResult with success/failure counts

§Example

let items = vec![
    StoreItem::new("doc-1", "First document").with_metadata(json!({"type": "note"})),
    StoreItem::new("doc-2", "Second document").with_metadata(json!({"type": "note"})),
];
let result = store_documents_batch(&engine, items).await?;
println!("Stored {} documents", result.success_count);