Skip to content

Example (DocumentLoader with Attachments)

Serdar Basegmez edited this page Jun 13, 2025 · 2 revisions
// Ingestor will combine the model + store + splitter
EmbeddingStoreIngestor ingestor = EmbeddingStoreIngestor.builder()
                                                        .embeddingModel(embeddingModel)
                                                        .embeddingStore(embeddingStore)
                                                        .documentSplitter(DocumentSplitters.recursive(8196, 256))
                                                        .build();

// Create a new metadata definition with a few fields on top of the default metadata
var metadataDef = MetadataDefinition.builder(MetadataDefinition.DEFAULT)
                                    .addString("PartyName")
                                    .addString("Country")
                                    .addInteger("Year")
                                    .build();


// Prepare list of Documents
// Note that Document here is not Domino Document.
List<Document> docs = DominoDocumentLoader.create(metadataDef)        // Start with a custom metadata
                                          .database(database)         // Use the given database
                                          .noteIds(manifestoDocIds)   // Load certain note ids.
                                          .filePattern("*.pdf")       // Only PDF documents
                                          .documentParser(            // Use PDF Document Paser
                                                new ApachePdfBoxDocumentParser())
                                          .loadDocuments();           // Load documents into a list

// Ingest documents
IngestionResult result = ingestor.ingest(docs);

See IngestManifestos.java for complete code

Clone this wiki locally