Package io.milvus.param.dml
Class SearchParam.Builder
- java.lang.Object
-
- io.milvus.param.dml.SearchParam.Builder
-
- Enclosing class:
- SearchParam
public static class SearchParam.Builder extends Object
Builder forSearchParamclass.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SearchParam.BuilderaddOutField(@NonNull String fieldName)Specifies an output field (Optional).SearchParam.BuilderaddPartitionName(@NonNull String partitionName)Adds a partition to specify search scope (Optional).SearchParambuild()Verifies parameters and creates a newSearchParaminstance.SearchParam.BuilderwithCollectionName(@NonNull String collectionName)Sets the collection name.SearchParam.BuilderwithConsistencyLevel(ConsistencyLevelEnum consistencyLevel)ConsistencyLevel of consistency level.SearchParam.BuilderwithExpr(@NonNull String expr)Sets expression to filter out entities before searching (Optional).SearchParam.BuilderwithGracefulTime(Long gracefulTime)Deprecated.SearchParam.BuilderwithGuaranteeTimestamp(@NonNull Long ts)Deprecated.SearchParam.BuilderwithIgnoreGrowing(@NonNull Boolean ignoreGrowing)Ignore the growing segments to get best search performance.SearchParam.BuilderwithMetricType(@NonNull MetricType metricType)Sets metric type of ANN searching.SearchParam.BuilderwithOutFields(@NonNull List<String> outFields)Specifies output fields (Optional).SearchParam.BuilderwithParams(@NonNull String params)Sets the search parameters specific to the index type.SearchParam.BuilderwithPartitionNames(@NonNull List<String> partitionNames)Sets partition names list to specify search scope (Optional).SearchParam.BuilderwithRoundDecimal(@NonNull Integer decimal)Specifies the decimal place of the returned results.SearchParam.BuilderwithTopK(@NonNull Integer topK)Sets topK value of ANN search.SearchParam.BuilderwithTravelTimestamp(@NonNull Long ts)Specify an absolute timestamp in a search to get results based on a data view at a specified point in time.SearchParam.BuilderwithVectorFieldName(@NonNull String vectorFieldName)Sets target vector field by name.SearchParam.BuilderwithVectors(@NonNull List<?> vectors)Sets the target vectors.
-
-
-
Method Detail
-
withCollectionName
public SearchParam.Builder withCollectionName(@NonNull @NonNull String collectionName)
Sets the collection name. Collection name cannot be empty or null.- Parameters:
collectionName- collection name- Returns:
Builder
-
withPartitionNames
public SearchParam.Builder withPartitionNames(@NonNull @NonNull List<String> partitionNames)
Sets partition names list to specify search scope (Optional).- Parameters:
partitionNames- partition names list- Returns:
Builder
-
withConsistencyLevel
public SearchParam.Builder withConsistencyLevel(ConsistencyLevelEnum consistencyLevel)
ConsistencyLevel of consistency level.- Parameters:
consistencyLevel- consistency level- Returns:
Builder
-
withGracefulTime
@Deprecated public SearchParam.Builder withGracefulTime(Long gracefulTime)
Deprecated.Graceful time for BOUNDED Consistency Level Note: This parameter is deprecated from Milvus v2.2.9, user only input consistency level to search. The time settings of different consistency levels are determined by the server side. For this reason, this method is marked as Deprecated in Java SDK v2.2.11- Parameters:
gracefulTime- graceful time- Returns:
Builder
-
addPartitionName
public SearchParam.Builder addPartitionName(@NonNull @NonNull String partitionName)
Adds a partition to specify search scope (Optional).- Parameters:
partitionName- partition name- Returns:
Builder
-
withMetricType
public SearchParam.Builder withMetricType(@NonNull @NonNull MetricType metricType)
Sets metric type of ANN searching.- Parameters:
metricType- metric type- Returns:
Builder
-
withVectorFieldName
public SearchParam.Builder withVectorFieldName(@NonNull @NonNull String vectorFieldName)
Sets target vector field by name. Field name cannot be empty or null.- Parameters:
vectorFieldName- vector field name- Returns:
Builder
-
withTopK
public SearchParam.Builder withTopK(@NonNull @NonNull Integer topK)
Sets topK value of ANN search.- Parameters:
topK- topK value- Returns:
Builder
-
withExpr
public SearchParam.Builder withExpr(@NonNull @NonNull String expr)
Sets expression to filter out entities before searching (Optional).- Parameters:
expr- filtering expression- Returns:
Builder- See Also:
- Boolean Expression Rules
-
withOutFields
public SearchParam.Builder withOutFields(@NonNull @NonNull List<String> outFields)
Specifies output fields (Optional).- Parameters:
outFields- output fields- Returns:
Builder
-
addOutField
public SearchParam.Builder addOutField(@NonNull @NonNull String fieldName)
Specifies an output field (Optional).- Parameters:
fieldName- filed name- Returns:
Builder
-
withVectors
public SearchParam.Builder withVectors(@NonNull @NonNull List<?> vectors)
Sets the target vectors.- Parameters:
vectors- list of target vectors: if vector type is FloatVector, vectors is List of List Float; if vector type is BinaryVector, vectors is List of ByteBuffer;- Returns:
Builder
-
withRoundDecimal
public SearchParam.Builder withRoundDecimal(@NonNull @NonNull Integer decimal)
Specifies the decimal place of the returned results.- Parameters:
decimal- how many digits after the decimal point- Returns:
Builder
-
withParams
public SearchParam.Builder withParams(@NonNull @NonNull String params)
Sets the search parameters specific to the index type. For example: IVF index, the search parameters can be "{\"nprobe\":10}" For more information: @see Index Selection- Parameters:
params- extra parameters in json format- Returns:
Builder
-
withTravelTimestamp
public SearchParam.Builder withTravelTimestamp(@NonNull @NonNull Long ts)
Specify an absolute timestamp in a search to get results based on a data view at a specified point in time. Default value is 0, server executes search on a full data view.- Parameters:
ts- a timestamp value- Returns:
Builder
-
withGuaranteeTimestamp
@Deprecated public SearchParam.Builder withGuaranteeTimestamp(@NonNull @NonNull Long ts)
Deprecated.Instructs server to see insert/delete operations performed before a provided timestamp. If no such timestamp is specified, the server will wait for the latest operation to finish and search. Note: The timestamp is not an absolute timestamp, it is a hybrid value combined by UTC time and internal flags. We call it TSO, for more information please refer to: https://github.com/milvus-io/milvus/blob/master/docs/design_docs/milvus_hybrid_ts_en.md You can get a TSO from insert/delete operations, see theMutationResultWrapperclass. Use an operation's TSO to set this parameter, the server will execute search after this operation is finished. Default value is GUARANTEE_EVENTUALLY_TS, server executes search immediately. Note: This parameter is deprecated from Milvus v2.2.9, user only input consistency level to search. The time settings of different consistency levels are determined by the server side. For this reason, this method is marked as Deprecated in Java SDK v2.2.11- Parameters:
ts- a timestamp value- Returns:
Builder
-
withIgnoreGrowing
public SearchParam.Builder withIgnoreGrowing(@NonNull @NonNull Boolean ignoreGrowing)
Ignore the growing segments to get best search performance. Default is False. For the user case that don't require data visibility.- Parameters:
ignoreGrowing-Boolean.TRUEignore, Boolean.FALSE is not- Returns:
Builder
-
build
public SearchParam build() throws ParamException
Verifies parameters and creates a newSearchParaminstance.- Returns:
SearchParam- Throws:
ParamException
-
-