Class MariaDBVectorStore.MariaDBBuilder

java.lang.Object
org.springframework.ai.vectorstore.AbstractVectorStoreBuilder<MariaDBVectorStore.MariaDBBuilder>
org.springframework.ai.vectorstore.mariadb.MariaDBVectorStore.MariaDBBuilder
All Implemented Interfaces:
VectorStore.Builder<MariaDBVectorStore.MariaDBBuilder>
Enclosing class:
MariaDBVectorStore

public static final class MariaDBVectorStore.MariaDBBuilder extends AbstractVectorStoreBuilder<MariaDBVectorStore.MariaDBBuilder>
Builder for creating instances of MariaDBVectorStore. This builder provides a fluent API for configuring all aspects of the vector store.
Since:
1.0.0
  • Method Details

    • schemaName

      public MariaDBVectorStore.MariaDBBuilder schemaName(String schemaName)
      Configures the schema name for the vector store table.
      Parameters:
      schemaName - the database schema name (can be null for default schema)
      Returns:
      this builder instance
    • vectorTableName

      public MariaDBVectorStore.MariaDBBuilder vectorTableName(String vectorTableName)
      Configures the vector store table name.
      Parameters:
      vectorTableName - the name for the vector store table (defaults to "vector_store")
      Returns:
      this builder instance
    • schemaValidation

      public MariaDBVectorStore.MariaDBBuilder schemaValidation(boolean schemaValidation)
      Configures whether schema validation should be performed.
      Parameters:
      schemaValidation - true to enable schema validation, false to disable
      Returns:
      this builder instance
    • dimensions

      public MariaDBVectorStore.MariaDBBuilder dimensions(int dimensions)
      Configures the dimension size of the embedding vectors.
      Parameters:
      dimensions - the dimension of the embeddings
      Returns:
      this builder instance
    • distanceType

      Configures the distance type used for similarity calculations.
      Parameters:
      distanceType - the distance type to use
      Returns:
      this builder instance
      Throws:
      IllegalArgumentException - if distanceType is null
    • removeExistingVectorStoreTable

      public MariaDBVectorStore.MariaDBBuilder removeExistingVectorStoreTable(boolean removeExistingVectorStoreTable)
      Configures whether to remove any existing vector store table.
      Parameters:
      removeExistingVectorStoreTable - true to remove existing table, false to keep it
      Returns:
      this builder instance
    • initializeSchema

      public MariaDBVectorStore.MariaDBBuilder initializeSchema(boolean initializeSchema)
      Configures whether to initialize the database schema.
      Parameters:
      initializeSchema - true to initialize schema, false otherwise
      Returns:
      this builder instance
    • maxDocumentBatchSize

      public MariaDBVectorStore.MariaDBBuilder maxDocumentBatchSize(int maxDocumentBatchSize)
      Configures the maximum batch size for document operations.
      Parameters:
      maxDocumentBatchSize - the maximum number of documents to process in a batch
      Returns:
      this builder instance
    • contentFieldName

      public MariaDBVectorStore.MariaDBBuilder contentFieldName(String name)
      Configures the name of the content field in the database.
      Parameters:
      name - the field name for document content (defaults to "content")
      Returns:
      this builder instance
      Throws:
      IllegalArgumentException - if name is null or empty
    • embeddingFieldName

      public MariaDBVectorStore.MariaDBBuilder embeddingFieldName(String name)
      Configures the name of the embedding field in the database.
      Parameters:
      name - the field name for embeddings (defaults to "embedding")
      Returns:
      this builder instance
      Throws:
      IllegalArgumentException - if name is null or empty
    • idFieldName

      public MariaDBVectorStore.MariaDBBuilder idFieldName(String name)
      Configures the name of the ID field in the database.
      Parameters:
      name - the field name for document IDs (defaults to "id")
      Returns:
      this builder instance
      Throws:
      IllegalArgumentException - if name is null or empty
    • metadataFieldName

      public MariaDBVectorStore.MariaDBBuilder metadataFieldName(String name)
      Configures the name of the metadata field in the database.
      Parameters:
      name - the field name for document metadata (defaults to "metadata")
      Returns:
      this builder instance
      Throws:
      IllegalArgumentException - if name is null or empty
    • build

      public MariaDBVectorStore build()
      Builds and returns a new MariaDBVectorStore instance with the configured settings.
      Returns:
      a new MariaDBVectorStore instance
      Throws:
      IllegalStateException - if the builder configuration is invalid