java.lang.Object
org.springframework.data.mongodb.core.index.VectorIndex
- All Implemented Interfaces:
SearchIndexDefinition
- Since:
- 4.5
- Author:
- Christoph Strobl, Mark Paluch
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumVector quantization.static enumSimilarity function used to calculate vector distance.static classBuilder to create a vector field -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a filter field.addVector(String path, Consumer<VectorIndex.VectorFieldBuilder> customizer) Add a vector field and accept aVectorIndex.VectorFieldBuildercustomizer.org.bson.DocumentgetDefinition(TypeInformation<?> entity, MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext) Returns the actual index definition for this index in the context of a potential entity to resolve field name mappings.getName()getType()toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.data.mongodb.core.index.SearchIndexDefinition
getIndexDocument, getRawIndexDocument
-
Constructor Details
-
VectorIndex
Create a newVectorIndexinstance.- Parameters:
name- The name of the index.
-
-
Method Details
-
addFilter
Add a filter field.- Parameters:
path- dot notation to field/property used for filtering.- Returns:
- this.
-
addVector
@Contract("_, _ -> this") public VectorIndex addVector(String path, Consumer<VectorIndex.VectorFieldBuilder> customizer) Add a vector field and accept aVectorIndex.VectorFieldBuildercustomizer.- Parameters:
path- dot notation to field/property used for filtering.customizer- customizer function.- Returns:
- this.
-
getName
- Specified by:
getNamein interfaceSearchIndexDefinition- Returns:
- the name of the index.
-
getType
- Specified by:
getTypein interfaceSearchIndexDefinition- Returns:
- the type of the index. Typically,
searchorvectorSearch.
-
getDefinition
public org.bson.Document getDefinition(@Nullable TypeInformation<?> entity, @Nullable MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext) Description copied from interface:SearchIndexDefinitionReturns the actual index definition for this index in the context of a potential entity to resolve field name mappings. Entity and context can be null to create a generic index definition without applying field name mapping.- Specified by:
getDefinitionin interfaceSearchIndexDefinition- Parameters:
entity- can be null.mappingContext- can be null.- Returns:
- never null.
-
toString
-