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
-
Field Summary
Fields inherited from class org.springframework.ai.vectorstore.AbstractVectorStoreBuilder
batchingStrategy, customObservationConvention, embeddingModel, observationRegistry
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds and returns a new MariaDBVectorStore instance with the configured settings.contentFieldName
(String name) Configures the name of the content field in the database.dimensions
(int dimensions) Configures the dimension size of the embedding vectors.distanceType
(MariaDBVectorStore.MariaDBDistanceType distanceType) Configures the distance type used for similarity calculations.embeddingFieldName
(String name) Configures the name of the embedding field in the database.idFieldName
(String name) Configures the name of the ID field in the database.initializeSchema
(boolean initializeSchema) Configures whether to initialize the database schema.maxDocumentBatchSize
(int maxDocumentBatchSize) Configures the maximum batch size for document operations.metadataFieldName
(String name) Configures the name of the metadata field in the database.removeExistingVectorStoreTable
(boolean removeExistingVectorStoreTable) Configures whether to remove any existing vector store table.schemaName
(String schemaName) Configures the schema name for the vector store table.schemaValidation
(boolean schemaValidation) Configures whether schema validation should be performed.vectorTableName
(String vectorTableName) Configures the vector store table name.Methods inherited from class org.springframework.ai.vectorstore.AbstractVectorStoreBuilder
batchingStrategy, customObservationConvention, getBatchingStrategy, getCustomObservationConvention, getEmbeddingModel, getObservationRegistry, observationRegistry, self
-
Method Details
-
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
Configures the vector store table name.- Parameters:
vectorTableName
- the name for the vector store table (defaults to "vector_store")- Returns:
- this builder instance
-
schemaValidation
Configures whether schema validation should be performed.- Parameters:
schemaValidation
- true to enable schema validation, false to disable- Returns:
- this builder instance
-
dimensions
Configures the dimension size of the embedding vectors.- Parameters:
dimensions
- the dimension of the embeddings- Returns:
- this builder instance
-
distanceType
public MariaDBVectorStore.MariaDBBuilder distanceType(MariaDBVectorStore.MariaDBDistanceType 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
Configures whether to initialize the database schema.- Parameters:
initializeSchema
- true to initialize schema, false otherwise- Returns:
- this builder instance
-
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
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
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
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
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
Builds and returns a new MariaDBVectorStore instance with the configured settings.- Returns:
- a new MariaDBVectorStore instance
- Throws:
IllegalStateException
- if the builder configuration is invalid
-