Package com.mongodb.client.model.search
Interface VectorSearchOptions
- All Superinterfaces:
Bson
Represents optional fields of the
$vectorSearch pipeline stage of an aggregation pipeline.- Since:
- 4.11
- See Also:
- MongoDB Atlas documentation
- $vectorSearch
- Since server release
- 6.0.10
-
Field Summary
Fields inherited from interface org.bson.conversions.Bson
DEFAULT_CODEC_REGISTRY -
Method Summary
Modifier and TypeMethodDescriptionCreates a newVectorSearchOptionswith the filter specified.Creates a newVectorSearchOptionswith the specified option in situations when there is no builder method that better satisfies your needs.static VectorSearchOptionsReturnsVectorSearchOptionsthat represents server defaults.Methods inherited from interface org.bson.conversions.Bson
toBsonDocument, toBsonDocument
-
Method Details
-
filter
Creates a newVectorSearchOptionswith the filter specified.- Parameters:
filter- A filter that is applied before applying thequeryVector. One may useFiltersto create this filter, though not all filters may be supported. See the MongoDB documentation for the list of supported filters.- Returns:
- A new
VectorSearchOptions.
-
option
Creates a newVectorSearchOptionswith the specified option in situations when there is no builder method that better satisfies your needs. This method cannot be used to validate the syntax.Example
The following code creates two functionally equivalentVectorSearchOptionsobjects, though they may not be equal.VectorSearchOptions options1 = VectorSearchOptions.vectorSearchOptions() .filter(Filters.lt("fieldName", 1)); VectorSearchOptions options2 = VectorSearchOptions.vectorSearchOptions() .option("filter", Filters.lt("fieldName", 1));- Parameters:
name- The option name.value- The option value.- Returns:
- A new
VectorSearchOptions.
-
vectorSearchOptions
ReturnsVectorSearchOptionsthat represents server defaults.- Returns:
VectorSearchOptionsthat represents server defaults.
-