@@ -452,6 +450,18 @@ public class VectorSearchOperation implements AggregationOperation {
return vector(Vector.of(vector));
}
+ /**
+ * Array of byte numbers that represent the query vector. The number type must match the indexed field value type.
+ * Otherwise, Atlas Vector Search doesn't return any results or errors.
+ *
+ * @param vector the query vector.
+ * @return
+ */
+ @Contract("_ -> this")
+ default LimitContributor vector(byte... vector) {
+ return vector(BinaryVector.int8Vector(vector));
+ }
+
/**
* Array of double numbers that represent the query vector. The number type must match the indexed field value type.
* Otherwise, Atlas Vector Search doesn't return any results or errors.
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MongoConverters.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MongoConverters.java
index d9f6ca43b..03216d096 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MongoConverters.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MongoConverters.java
@@ -15,7 +15,7 @@
*/
package org.springframework.data.mongodb.core.convert;
-import static org.springframework.data.convert.ConverterBuilder.*;
+import static org.springframework.data.convert.ConverterBuilder.reading;
import java.math.BigDecimal;
import java.math.BigInteger;
@@ -47,7 +47,6 @@ import org.bson.types.Binary;
import org.bson.types.Code;
import org.bson.types.Decimal128;
import org.bson.types.ObjectId;
-
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.converter.ConditionalConverter;
@@ -119,6 +118,8 @@ abstract class MongoConverters {
converters.add(reading(BsonUndefined.class, Object.class, it -> null));
converters.add(reading(String.class, URI.class, URI::create).andWriting(URI::toString));
+ converters.add(ByteArrayConverterFactory.INSTANCE);
+
return converters;
}
@@ -473,6 +474,48 @@ abstract class MongoConverters {
}
}
+ @WritingConverter
+ enum ByteArrayConverterFactory implements ConverterFactory, ConditionalConverter {
+
+ INSTANCE;
+
+ @Override
+ public Converter getConverter(Class targetType) {
+ return new ByteArrayConverter<>(targetType);
+ }
+
+ @Override
+ public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
+ return targetType.getType() != Object.class && !sourceType.equals(targetType);
+ }
+
+ private final static class ByteArrayConverter implements Converter {
+
+ private final Class targetType;
+
+ /**
+ * Creates a new {@link ByteArrayConverter} for the given target type.
+ *
+ * @param targetType must not be {@literal null}.
+ */
+ public ByteArrayConverter(Class targetType) {
+
+ Assert.notNull(targetType, "Target type must not be null");
+
+ this.targetType = targetType;
+ }
+
+ @Override
+ public T convert(byte[] source) {
+
+ if (this.targetType == BinaryVector.class) {
+ return (T) BinaryVector.int8Vector(source);
+ }
+ return (T) source;
+ }
+ }
+ }
+
/**
* {@link ConverterFactory} implementation converting {@link AtomicLong} into {@link Long}.
*
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/DefaultSearchIndexOperations.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/DefaultSearchIndexOperations.java
index e6a8778d7..225bb41ac 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/DefaultSearchIndexOperations.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/DefaultSearchIndexOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2024 the original author or authors.
+ * Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,16 +18,15 @@ package org.springframework.data.mongodb.core.index;
import java.util.ArrayList;
import java.util.List;
+import org.bson.BsonString;
import org.bson.Document;
-
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.mongodb.core.MongoOperations;
-import org.springframework.data.mongodb.core.aggregation.Aggregation;
-import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;
+import org.springframework.util.StringUtils;
import com.mongodb.client.model.SearchIndexModel;
import com.mongodb.client.model.SearchIndexType;
@@ -35,7 +34,7 @@ import com.mongodb.client.model.SearchIndexType;
/**
* @author Christoph Strobl
* @author Mark Paluch
- * @since 3.5
+ * @since 4.5
*/
public class DefaultSearchIndexOperations implements SearchIndexOperations {
@@ -48,6 +47,7 @@ public class DefaultSearchIndexOperations implements SearchIndexOperations {
}
public DefaultSearchIndexOperations(MongoOperations mongoOperations, String collectionName, @Nullable Class> type) {
+
this.collectionName = collectionName;
if (type != null) {
@@ -63,80 +63,63 @@ public class DefaultSearchIndexOperations implements SearchIndexOperations {
}
@Override
- public String ensureIndex(SearchIndexDefinition indexDefinition) {
-
- if (!(indexDefinition instanceof VectorIndex vsi)) {
- throw new IllegalStateException("Index definitions must be of type VectorIndex");
- }
+ public String createIndex(SearchIndexDefinition indexDefinition) {
Document index = indexDefinition.getIndexDocument(entityTypeInformation,
mongoOperations.getConverter().getMappingContext());
- mongoOperations.getCollection(collectionName).createSearchIndexes(List
- .of(new SearchIndexModel(vsi.getName(), (Document) index.get("definition"), SearchIndexType.vectorSearch())));
+ mongoOperations.getCollection(collectionName)
+ .createSearchIndexes(List.of(new SearchIndexModel(indexDefinition.getName(),
+ index.get("definition", Document.class), SearchIndexType.of(new BsonString(indexDefinition.getType())))));
- return vsi.getName();
+ return indexDefinition.getName();
}
@Override
- public void updateIndex(SearchIndexDefinition index) {
+ public void updateIndex(SearchIndexDefinition indexDefinition) {
- if (index instanceof VectorIndex) {
- throw new UnsupportedOperationException("Vector Index definitions cannot be updated");
- }
-
- Document indexDocument = index.getIndexDocument(entityTypeInformation,
+ Document indexDocument = indexDefinition.getIndexDocument(entityTypeInformation,
mongoOperations.getConverter().getMappingContext());
- mongoOperations.getCollection(collectionName).updateSearchIndex(index.getName(), indexDocument);
+ mongoOperations.getCollection(collectionName).updateSearchIndex(indexDefinition.getName(), indexDocument);
}
@Override
public boolean exists(String indexName) {
-
- List indexes = mongoOperations.getCollection(collectionName).listSearchIndexes().into(new ArrayList<>());
-
- for (Document index : indexes) {
- if (index.getString("name").equals(indexName)) {
- return true;
- }
- }
-
- return false;
+ return getSearchIndex(indexName) != null;
}
@Override
- public List getIndexInfo() {
+ public SearchIndexStatus status(String indexName) {
- AggregationResults aggregate = mongoOperations.aggregate(
- Aggregation.newAggregation(context -> new Document("$listSearchIndexes", new Document())), collectionName,
- Document.class);
-
- ArrayList result = new ArrayList<>();
- for (Document doc : aggregate) {
-
- List indexFields = new ArrayList<>();
- String name = doc.getString("name");
- for (Object field : doc.get("latestDefinition", Document.class).get("fields", List.class)) {
-
- if (field instanceof Document fieldInfo) {
- indexFields.add(IndexField.vector(fieldInfo.getString("path")));
- }
- }
-
- result.add(new IndexInfo(indexFields, name, false, false, null, false));
- }
- return result;
+ Document searchIndex = getSearchIndex(indexName);
+ return searchIndex != null ? SearchIndexStatus.valueOf(searchIndex.getString("status"))
+ : SearchIndexStatus.DOES_NOT_EXIST;
}
@Override
public void dropAllIndexes() {
- getIndexInfo().forEach(indexInfo -> dropIndex(indexInfo.getName()));
+ getSearchIndexes(null).forEach(indexInfo -> dropIndex(indexInfo.getString("name")));
}
@Override
- public void dropIndex(String name) {
- mongoOperations.getCollection(collectionName).dropSearchIndex(name);
+ public void dropIndex(String indexName) {
+ mongoOperations.getCollection(collectionName).dropSearchIndex(indexName);
+ }
+
+ @Nullable
+ private Document getSearchIndex(String indexName) {
+
+ List indexes = getSearchIndexes(indexName);
+ return indexes.isEmpty() ? null : indexes.iterator().next();
+ }
+
+ private List getSearchIndexes(@Nullable String indexName) {
+
+ Document filter = StringUtils.hasText(indexName) ? new Document("name", indexName) : new Document();
+
+ return mongoOperations.getCollection(collectionName).aggregate(List.of(new Document("$listSearchIndexes", filter)))
+ .into(new ArrayList<>());
}
}
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexOperations.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexOperations.java
index 144e0aea4..fe2e569a4 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexOperations.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexOperations.java
@@ -33,9 +33,23 @@ public interface IndexOperations {
*
* @param indexDefinition must not be {@literal null}.
* @return the index name.
+ * @deprecated in favor of {@link #createIndex(IndexDefinition)}.
*/
+ @Deprecated(since = "4.5", forRemoval = true)
String ensureIndex(IndexDefinition indexDefinition);
+ /**
+ * Create the index for the provided {@link IndexDefinition} exists for the collection indicated by the entity
+ * class. If not it will be created.
+ *
+ * @param indexDefinition must not be {@literal null}.
+ * @return the index name.
+ * @since 4.5
+ */
+ default String createIndex(IndexDefinition indexDefinition) {
+ return ensureIndex(indexDefinition);
+ }
+
/**
* Alters the index with given {@literal name}.
*
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexDefinition.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexDefinition.java
index 05db5e4ed..2cb4eff0e 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexDefinition.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexDefinition.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
package org.springframework.data.mongodb.core.index;
import org.bson.Document;
-
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
@@ -42,17 +41,28 @@ public interface SearchIndexDefinition {
*/
String getType();
+ /**
+ * Returns the index document for this index without any potential entity context resolving field name mappings. The
+ * resulting document contains the index name, type and {@link #getDefinition(TypeInformation, MappingContext)
+ * definition}.
+ *
+ * @return never {@literal null}.
+ */
+ default Document getRawIndexDocument() {
+ return getIndexDocument(null, null);
+ }
+
/**
* Returns the index document for this index in the context of a potential entity to resolve field name mappings. The
* resulting document contains the index name, type and {@link #getDefinition(TypeInformation, MappingContext)
* definition}.
*
- * @param entity
+ * @param entity can be {@literal null}.
* @param mappingContext
- * @return
+ * @return never {@literal null}.
*/
default Document getIndexDocument(@Nullable TypeInformation> entity,
- MappingContext extends MongoPersistentEntity>, MongoPersistentProperty> mappingContext) {
+ @Nullable MappingContext extends MongoPersistentEntity>, MongoPersistentProperty> mappingContext) {
Document document = new Document();
document.put("name", getName());
@@ -66,11 +76,10 @@ public interface SearchIndexDefinition {
* Returns the actual index definition for this index in the context of a potential entity to resolve field name
* mappings.
*
- * @param entity
+ * @param entity can be {@literal null}.
* @param mappingContext
- * @return
+ * @return never {@literal null}.
*/
Document getDefinition(@Nullable TypeInformation> entity,
- MappingContext extends MongoPersistentEntity>, MongoPersistentProperty> mappingContext);
-
+ @Nullable MappingContext extends MongoPersistentEntity>, MongoPersistentProperty> mappingContext);
}
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexInfo.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexInfo.java
new file mode 100644
index 000000000..01f4374f4
--- /dev/null
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexInfo.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2025 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.data.mongodb.core.index;
+
+import java.util.function.Supplier;
+
+import org.bson.Document;
+import org.springframework.data.mapping.context.MappingContext;
+import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
+import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
+import org.springframework.data.util.Lazy;
+import org.springframework.data.util.TypeInformation;
+import org.springframework.lang.Nullable;
+
+/**
+ * Index information for a MongoDB Search Index.
+ *
+ * @author Christoph Strobl
+ */
+public class SearchIndexInfo {
+
+ private final @Nullable Object id;
+ private final SearchIndexStatus status;
+ private final Lazy indexDefinition;
+
+ SearchIndexInfo(@Nullable Object id, SearchIndexStatus status, Supplier indexDefinition) {
+ this.id = id;
+ this.status = status;
+ this.indexDefinition = Lazy.of(indexDefinition);
+ }
+
+ public static SearchIndexInfo parse(String source) {
+ return of(Document.parse(source));
+ }
+
+ public static SearchIndexInfo of(Document indexDocument) {
+
+ Object id = indexDocument.get("id");
+ SearchIndexStatus status = SearchIndexStatus.valueOf(indexDocument.get("status", "DOES_NOT_EXIST"));
+
+ return new SearchIndexInfo(id, status, () -> readIndexDefinition(indexDocument));
+ }
+
+ /**
+ * The id of the index. Can be {@literal null}, eg. for an index not yet created.
+ *
+ * @return can be {@literal null}.
+ */
+ @Nullable
+ public Object getId() {
+ return id;
+ }
+
+ /**
+ * @return the current status of the index.
+ */
+ public SearchIndexStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * @return the current index definition.
+ */
+ public SearchIndexDefinition getIndexDefinition() {
+ return indexDefinition.get();
+ }
+
+ private static SearchIndexDefinition readIndexDefinition(Document document) {
+
+ String type = document.get("type", "search");
+ if (type.equals("vectorSearch")) {
+ return VectorIndex.of(document);
+ }
+
+ return new SearchIndexDefinition() {
+
+ @Override
+ public String getName() {
+ return document.getString("name");
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public Document getDefinition(@Nullable TypeInformation> entity,
+ @Nullable MappingContext extends MongoPersistentEntity>, MongoPersistentProperty> mappingContext) {
+ if (document.containsKey("latestDefinition")) {
+ return document.get("latestDefinition", new Document());
+ }
+ return document.get("definition", new Document());
+ }
+
+ @Override
+ public String toString() {
+ return getDefinition(null, null).toJson();
+ }
+ };
+ }
+}
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexOperations.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexOperations.java
index 24b7bc1f3..d68b547a3 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexOperations.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexOperations.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2024. the original author or authors.
+ * Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,7 +15,7 @@
*/
package org.springframework.data.mongodb.core.index;
-import java.util.List;
+import org.springframework.dao.DataAccessException;
/**
* Search Index operations on a collection for Atlas Search.
@@ -23,52 +23,65 @@ import java.util.List;
* @author Christoph Strobl
* @author Mark Paluch
* @since 4.5
+ * @see VectorIndex
*/
public interface SearchIndexOperations {
/**
- * Ensure that an index for the provided {@link SearchIndexDefinition} exists for the collection indicated by the
- * entity class. If not it will be created.
+ * Create the index for the given {@link SearchIndexDefinition} in the collection indicated by the entity class.
*
* @param indexDefinition must not be {@literal null}.
* @return the index name.
*/
- String ensureIndex(SearchIndexDefinition indexDefinition);
+ // TODO: keep or just go with createIndex?
+ default String ensureIndex(SearchIndexDefinition indexDefinition) {
+ return createIndex(indexDefinition);
+ }
/**
- * Alters the search {@code index}.
- *
- * Note that Atlas Search does not support updating Vector Search Indices resulting in
- * {@link UnsupportedOperationException}.
+ * Create the index for the given {@link SearchIndexDefinition} in the collection indicated by the entity class.
*
- * @param index the index definition.
+ * @param indexDefinition must not be {@literal null}.
+ * @return the index name.
*/
- void updateIndex(SearchIndexDefinition index);
+ String createIndex(SearchIndexDefinition indexDefinition);
/**
- * Check whether an index with the {@code name} exists.
+ * Alters the search index matching the index {@link SearchIndexDefinition#getName() name}.
+ *
+ * Atlas Search might not support updating indices which raises a {@link DataAccessException}.
*
- * @param name name of index to check for presence.
+ * @param indexDefinition the index definition.
+ */
+ // TODO: keep or remove since it does not work reliably?
+ void updateIndex(SearchIndexDefinition indexDefinition);
+
+ /**
+ * Check whether an index with the given {@code indexName} exists for the collection indicated by the entity class. To
+ * ensure an existing index is queryable it is recommended to check its {@link #status(String) status}.
+ *
+ * @param indexName name of index to check for presence.
* @return {@literal true} if the index exists; {@literal false} otherwise.
*/
- boolean exists(String name);
+ boolean exists(String indexName);
/**
- * Drops an index from this collection.
+ * Check the actual {@link SearchIndexStatus status} of an index.
*
- * @param name name of index to drop.
+ * @param indexName name of index to get the status for.
+ * @return the current status of the index or {@link SearchIndexStatus#DOES_NOT_EXIST} if the index cannot be found.
*/
- void dropIndex(String name);
+ SearchIndexStatus status(String indexName);
/**
- * Drops all search indices from this collection.
+ * Drops an index from the collection indicated by the entity class.
+ *
+ * @param indexName name of index to drop.
+ */
+ void dropIndex(String indexName);
+
+ /**
+ * Drops all search indices from the collection indicated by the entity class.
*/
void dropAllIndexes();
-
- /**
- * Returns the index information on the collection.
- *
- * @return index information on the collection
- */
- List getIndexInfo();
}
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexOperationsProvider.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexOperationsProvider.java
index 389b666a2..ee87c8d61 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexOperationsProvider.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexOperationsProvider.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2024. the original author or authors.
+ * Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexStatus.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexStatus.java
new file mode 100644
index 000000000..91143d73c
--- /dev/null
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/SearchIndexStatus.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2025. the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.data.mongodb.core.index;
+
+/**
+ * Representation of different conditions a search index can be in.
+ *
+ * @author Christoph Strobl
+ * @since 4.5
+ */
+public enum SearchIndexStatus {
+
+ /** building or re-building the index - might be queryable */
+ BUILDING,
+
+ /** nothing to be seen here - not queryable */
+ DOES_NOT_EXIST,
+
+ /** will cease to exist - no longer queryable */
+ DELETING,
+
+ /** well, this one is broken - not queryable */
+ FAILED,
+
+ /** busy with other things, check back later - not queryable */
+ PENDING,
+
+ /** ask me anything - queryable */
+ READY,
+
+ /** ask me anything about outdated data - still queryable */
+ STALE
+}
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/VectorIndex.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/VectorIndex.java
index 9c5698985..20cf2a8ff 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/VectorIndex.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/VectorIndex.java
@@ -36,7 +36,6 @@ import java.util.List;
import java.util.function.Consumer;
import org.bson.Document;
-
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.mongodb.core.convert.QueryMapper;
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
@@ -45,9 +44,10 @@ import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Contract;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
+import org.springframework.util.StringUtils;
/**
- * {@link IndexDefinition} for creating MongoDB
+ * {@link SearchIndexDefinition} for creating MongoDB
* Vector Index required to
* run {@code $vectorSearch} queries.
*
@@ -58,7 +58,7 @@ import org.springframework.util.Assert;
public class VectorIndex implements SearchIndexDefinition {
private final String name;
- private final List