Package dyntabs.ai

Class IndexerBuilder

java.lang.Object
dyntabs.ai.IndexerBuilder

public class IndexerBuilder extends Object
Entry step for the document-indexing pipeline — picks where the vectors go, then hands you an EasyIndexer that knows how to put them there.

Analogy: this is the "choose your destination" screen. Like calling DriverManager.getConnection(url) before you can run any SQL, you first say .toMilvus(...) to get something you can actually index(...) into. Separating the two steps keeps the door open for future destinations (pgvector, Chroma, ...) without changing how callers start the chain.

You never construct this directly — start from EasyAI.indexer():


 EasyAI.indexer()
       .toMilvus("localhost", 19530, "documents")
       .index("file:/data/policy.pdf");
 
See Also:
  • Method Details

    • withEventListener

      public IndexerBuilder withEventListener(EasyAIListener eventListener)
      Registers a listener that receives a live EasyAIEvent stream as documents are loaded, embedded, and upserted into the vector store.

      Call this before toMilvus(...) so the destination indexer inherits it. The indexer emits EasyAIEvent.Phase.STARTED when indexing begins, a EasyAIEvent.Phase.PROGRESS event per source document and one for the store-upsert step, then EasyAIEvent.Phase.FINISHED (or EasyAIEvent.Phase.ERROR).

      Familiar analogy: a parcel-tracking page for a bulk shipment — instead of only learning "all 200 boxes delivered" at the end, you watch each box move through the depot.

      
       int n = EasyAI.indexer()
                     .withEventListener(e -> log.info("{}", e))
                     .toMilvus("localhost", 19530, "documents")
                     .index("file:/data/policy.pdf", "classpath:faq.txt");
       
      Parameters:
      eventListener - the listener to receive ingestion events (may be null)
      Returns:
      this builder
      See Also:
    • toMilvus

      public EasyIndexer toMilvus(String host, int port, String collectionName)
      Targets a Milvus collection using explicit connection settings, with the default embedding dimension (384).

      Called as the first link after EasyAI.indexer(); returns the configured EasyIndexer on which you call index(...).

      Parameters:
      host - Milvus server hostname (e.g. "localhost")
      port - Milvus server port (typically 19530)
      collectionName - the target collection
      Returns:
      an EasyIndexer bound to that collection
    • toMilvus

      public EasyIndexer toMilvus(MilvusConfig config)
      Targets a Milvus collection using a fully built MilvusConfig.

      Use this overload when you need a non-default dimension or credentials.

      Parameters:
      config - the Milvus connection settings
      Returns:
      an EasyIndexer bound to that collection
    • toMilvus

      public EasyIndexer toMilvus()
      Targets a Milvus collection configured entirely from easyai.properties (keys easyai.milvus.*).

      The zero-argument, "it's all in config" path — ideal for Jakarta EE apps that keep environment settings out of code.

      Returns:
      an EasyIndexer bound to the collection described in properties
      See Also: