Skip to content

Commit b15d5ff

Browse files
committed
MariaDB vector store builder refactoring
1 parent 9e18652 commit b15d5ff

File tree

7 files changed

+366
-60
lines changed

7 files changed

+366
-60
lines changed

spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/mariadb/MariaDbStoreAutoConfiguration.java

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,23 @@ public MariaDBVectorStore vectorStore(JdbcTemplate jdbcTemplate, EmbeddingModel
5757

5858
var initializeSchema = properties.isInitializeSchema();
5959

60-
return new MariaDBVectorStore.Builder(jdbcTemplate, embeddingModel).withSchemaName(properties.getSchemaName())
61-
.withVectorTableName(properties.getTableName())
62-
.withVectorTableValidationsEnabled(properties.isSchemaValidation())
63-
.withDimensions(properties.getDimensions())
64-
.withDistanceType(properties.getDistanceType())
65-
.withContentFieldName(properties.getContentFieldName())
66-
.withEmbeddingFieldName(properties.getEmbeddingFieldName())
67-
.withIdFieldName(properties.getIdFieldName())
68-
.withMetadataFieldName(properties.getMetadataFieldName())
69-
.withRemoveExistingVectorStoreTable(properties.isRemoveExistingVectorStoreTable())
70-
.withInitializeSchema(initializeSchema)
71-
.withObservationRegistry(observationRegistry.getIfUnique(() -> ObservationRegistry.NOOP))
72-
.withSearchObservationConvention(customObservationConvention.getIfAvailable(() -> null))
73-
.withBatchingStrategy(batchingStrategy)
74-
.withMaxDocumentBatchSize(properties.getMaxDocumentBatchSize())
60+
return MariaDBVectorStore.builder(jdbcTemplate)
61+
.embeddingModel(embeddingModel)
62+
.schemaName(properties.getSchemaName())
63+
.vectorTableName(properties.getTableName())
64+
.schemaValidation(properties.isSchemaValidation())
65+
.dimensions(properties.getDimensions())
66+
.distanceType(properties.getDistanceType())
67+
.contentFieldName(properties.getContentFieldName())
68+
.embeddingFieldName(properties.getEmbeddingFieldName())
69+
.idFieldName(properties.getIdFieldName())
70+
.metadataFieldName(properties.getMetadataFieldName())
71+
.removeExistingVectorStoreTable(properties.isRemoveExistingVectorStoreTable())
72+
.initializeSchema(initializeSchema)
73+
.observationRegistry(observationRegistry.getIfUnique(() -> ObservationRegistry.NOOP))
74+
.customObservationConvention(customObservationConvention.getIfAvailable(() -> null))
75+
.batchingStrategy(batchingStrategy)
76+
.maxDocumentBatchSize(properties.getMaxDocumentBatchSize())
7577
.build();
7678
}
7779

0 commit comments

Comments
 (0)