io.milvus.param.dml

## Class AnnSearchParam.Builder

- java.lang.Object
- - io.milvus.param.dml.AnnSearchParam.Builder

- Enclosing class:
    AnnSearchParam

      public static class AnnSearchParam.Builder
      extends java.lang.Object

  Builder for `AnnSearchParam` class.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AnnSearchParam` | `build()` Verifies parameters and creates a new `AnnSearchParam` instance.
    `AnnSearchParam.Builder` | `withBFloat16Vectors(@NonNull java.util.List<java.nio.ByteBuffer> vectors)` Sets the target vectors to search on BFloat16Vector field.
    `AnnSearchParam.Builder` | `withBinaryVectors(@NonNull java.util.List<java.nio.ByteBuffer> vectors)` Sets the target vectors to search on BinaryVector field.
    `AnnSearchParam.Builder` | `withExpr(@NonNull java.lang.String expr)` Sets expression to filter out entities before searching (Optional).
    `AnnSearchParam.Builder` | `withFloat16Vectors(@NonNull java.util.List<java.nio.ByteBuffer> vectors)` Sets the target vectors to search on Float16Vector field.
    `AnnSearchParam.Builder` | `withFloatVectors(@NonNull java.util.List<java.util.List<java.lang.Float>> vectors)` Sets the target vectors to search on FloatVector field.
    `AnnSearchParam.Builder` | `withMetricType(@NonNull MetricType metricType)` Sets metric type of ANN searching.
    `AnnSearchParam.Builder` | `withParams(@NonNull java.lang.String params)` Sets the search parameters specific to the index type.
    `AnnSearchParam.Builder` | `withSparseFloatVectors(@NonNull java.util.List<java.util.SortedMap<java.lang.Long,java.lang.Float>> vectors)` Sets the target vectors to search on SparseFloatVector field.
    `AnnSearchParam.Builder` | `withTopK(@NonNull java.lang.Integer topK)` Sets topK value of ANN search.
    `AnnSearchParam.Builder` | `withVectorFieldName(@NonNull java.lang.String vectorFieldName)` Sets target vector field by name.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### withMetricType

          public AnnSearchParam.Builder withMetricType(@NonNull
                                                       @NonNull MetricType metricType)

      Sets metric type of ANN searching.
      Parameters:
        `metricType` - metric type
      Returns:
        `Builder`

    - #### withVectorFieldName

          public AnnSearchParam.Builder withVectorFieldName(@NonNull
                                                            @NonNull java.lang.String vectorFieldName)

      Sets target vector field by name. Field name cannot be empty or null.
      Parameters:
        `vectorFieldName` - vector field name
      Returns:
        `Builder`

    - #### withTopK

          public AnnSearchParam.Builder withTopK(@NonNull
                                                 @NonNull java.lang.Integer topK)

      Sets topK value of ANN search.
      Parameters:
        `topK` - topK value
      Returns:
        `Builder`

    - #### withExpr

          public AnnSearchParam.Builder withExpr(@NonNull
                                                 @NonNull java.lang.String expr)

      Sets expression to filter out entities before searching (Optional).
      Parameters:
        `expr` - filtering expression
      Returns:
        `Builder`
      See Also:
        Boolean Expression Rules

    - #### withFloatVectors

          public AnnSearchParam.Builder withFloatVectors(@NonNull
                                                         @NonNull java.util.List<java.util.List<java.lang.Float>> vectors)

      Sets the target vectors to search on FloatVector field.
      Parameters:
        `vectors` - target vectors to search
      Returns:
        `Builder`

    - #### withBinaryVectors

          public AnnSearchParam.Builder withBinaryVectors(@NonNull
                                                          @NonNull java.util.List<java.nio.ByteBuffer> vectors)

      Sets the target vectors to search on BinaryVector field.
      Parameters:
        `vectors` - target vectors to search
      Returns:
        `Builder`

    - #### withFloat16Vectors

          public AnnSearchParam.Builder withFloat16Vectors(@NonNull
                                                           @NonNull java.util.List<java.nio.ByteBuffer> vectors)

      Sets the target vectors to search on Float16Vector field.
      Parameters:
        `vectors` - target vectors to search
      Returns:
        `Builder`

    - #### withBFloat16Vectors

          public AnnSearchParam.Builder withBFloat16Vectors(@NonNull
                                                            @NonNull java.util.List<java.nio.ByteBuffer> vectors)

      Sets the target vectors to search on BFloat16Vector field.
      Parameters:
        `vectors` - target vectors to search
      Returns:
        `Builder`

    - #### withSparseFloatVectors

          public AnnSearchParam.Builder withSparseFloatVectors(@NonNull
                                                               @NonNull java.util.List<java.util.SortedMap<java.lang.Long,java.lang.Float>> vectors)

      Sets the target vectors to search on SparseFloatVector field.
      Parameters:
        `vectors` - target vectors to search
      Returns:
        `Builder`

    - #### withParams

          public AnnSearchParam.Builder withParams(@NonNull
                                                   @NonNull java.lang.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`

    - #### build

          public AnnSearchParam build()
                               throws ParamException

      Verifies parameters and creates a new `AnnSearchParam` instance.
      Returns:
        `AnnSearchParam`
      Throws:
        `ParamException`