Class EasyIndexer
Analogy: if an @EasyAIAssistant that reads from a store is the
"reader", EasyIndexer is the "librarian who shelves the books." You hand it
raw documents (paths, byte arrays, or plain text); it parses, splits, embeds, and files
them away in Milvus under the collection chosen via IndexerBuilder.toMilvus(java.lang.String, int, java.lang.String).
One call replaces the parse → split → embed → batch-insert boilerplate you'd otherwise
write against the raw Milvus client.
You don't construct this directly — it comes from EasyAI.indexer():
// Index files on disk / classpath
int n = EasyAI.indexer()
.toMilvus("localhost", 19530, "documents")
.index("file:/data/policy.pdf", "classpath:faq.txt");
// Index bytes pulled from a DMS or DB BLOB
byte[] pdf = dms.download("DOC-1");
EasyAI.indexer()
.toMilvus() // settings from easyai.properties
.index(DocumentSource.of("policy.pdf", pdf));
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintindex(DocumentSource... sources) Indexes in-memory documents (byte arrays) — for content from a DMS, database BLOB, REST API, or user upload.intIndexes documents identified by path strings (classpath, file system, or relative).intindex(List<DocumentSource> sources) Indexes a list of in-memory documents (byte arrays).
-
Method Details
-
index
Indexes documents identified by path strings (classpath, file system, or relative).Terminal step of the
EasyAI.indexer().toMilvus(...).index(...)chain. Delegates loading toRagEngine.loadDocuments(String[])and persistence toMilvusEngine.ingest(List, MilvusConfig).- Parameters:
sources- one or more paths, each optionally prefixedclasspath:orfile:- Returns:
- the number of documents successfully ingested
-
index
Indexes in-memory documents (byte arrays) — for content from a DMS, database BLOB, REST API, or user upload.Terminal step of the indexer chain. Delegates parsing to
RagEngine.parseDocumentSources(List)and persistence toMilvusEngine.ingest(List, MilvusConfig).- Parameters:
sources- one or moreDocumentSources carrying file name + bytes- Returns:
- the number of documents successfully ingested
-
index
Indexes a list of in-memory documents (byte arrays). Same behaviour asindex(DocumentSource...), for when you already hold aList.- Parameters:
sources- the documents to ingest- Returns:
- the number of documents successfully ingested
-