# QueryParam.Builder

Package io.milvus.param.dml

## Class QueryParam.Builder

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

Enclosing class:
  QueryParam

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

Builder for `QueryParam` class.

### Method Summary

All Methods Instance Methods Concrete Methods
`QueryParam.Builder` `addOutField​(@NonNull java.lang.String fieldName)` Specifies an output field (Optional).
`QueryParam.Builder` `addPartitionName​(@NonNull java.lang.String partitionName)` Adds a partition to specify query scope (Optional).
`QueryParam` `build()` Verifies parameters and creates a new `QueryParam` instance.
`QueryParam.Builder` `withCollectionName​(@NonNull java.lang.String collectionName)` Sets the collection name.
`QueryParam.Builder` `withConsistencyLevel​(ConsistencyLevelEnum consistencyLevel)` ConsistencyLevel of consistency level.
`QueryParam.Builder` `withExpr​(@NonNull java.lang.String expr)` Sets the expression to query entities.
`QueryParam.Builder` `withIgnoreGrowing​(@NonNull java.lang.Boolean ignoreGrowing)` Ignore the growing segments to get best query performance.
`QueryParam.Builder` `withLimit​(@NonNull java.lang.Long limit)` Specify a value to control the returned number of entities.
`QueryParam.Builder` `withOffset​(@NonNull java.lang.Long offset)` Specify a position to return results.
`QueryParam.Builder` `withOutFields​(@NonNull java.util.List<java.lang.String> outFields)` Specifies output fields (Optional).
`QueryParam.Builder` `withPartitionNames​(@NonNull java.util.List<java.lang.String> partitionNames)` Sets partition names list to specify query scope (Optional).

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

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

### Method Detail

#### withCollectionName

    public QueryParam.Builder withCollectionName​(@NonNull
                                                 @NonNull java.lang.String collectionName)

Sets the collection name. Collection name cannot be empty or null.

Parameters:
  `collectionName` - collection name
Returns:
  `Builder`

#### withConsistencyLevel

    public QueryParam.Builder withConsistencyLevel​(ConsistencyLevelEnum consistencyLevel)

ConsistencyLevel of consistency level.

Parameters:
  `consistencyLevel` - consistency level
Returns:
  `Builder`

#### withPartitionNames

    public QueryParam.Builder withPartitionNames​(@NonNull
                                                 @NonNull java.util.List<java.lang.String> partitionNames)

Sets partition names list to specify query scope (Optional).

Parameters:
  `partitionNames` - partition names list
Returns:
  `Builder`

#### addPartitionName

    public QueryParam.Builder addPartitionName​(@NonNull
                                               @NonNull java.lang.String partitionName)

Adds a partition to specify query scope (Optional).

Parameters:
  `partitionName` - partition name
Returns:
  `Builder`

#### withOutFields

    public QueryParam.Builder withOutFields​(@NonNull
                                            @NonNull java.util.List<java.lang.String> outFields)

Specifies output fields (Optional).

Parameters:
  `outFields` - output fields
Returns:
  `Builder`

#### addOutField

    public QueryParam.Builder addOutField​(@NonNull
                                          @NonNull java.lang.String fieldName)

Specifies an output field (Optional).

Parameters:
  `fieldName` - field name
Returns:
  `Builder`

#### withExpr

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

Sets the expression to query entities.

Parameters:
  `expr` - filtering expression
Returns:
  `Builder`
See Also:
  Boolean Expression Rules

#### withOffset

    public QueryParam.Builder withOffset​(@NonNull
                                         @NonNull java.lang.Long offset)

Specify a position to return results. Only take effect when the 'limit' value is specified. Default value is 0, start from begin.

Parameters:
  `offset` - a value to define the position
Returns:
  `Builder`

#### withLimit

    public QueryParam.Builder withLimit​(@NonNull
                                        @NonNull java.lang.Long limit)

Specify a value to control the returned number of entities. Must be a positive value. Default value is 0, will return without limit.

Parameters:
  `limit` - a value to define the limit of returned entities
Returns:
  `Builder`

#### withIgnoreGrowing

    public QueryParam.Builder withIgnoreGrowing​(@NonNull
                                                @NonNull java.lang.Boolean ignoreGrowing)

Ignore the growing segments to get best query performance. Default is False. For the user case that don't require data visibility.

Parameters:
  `ignoreGrowing` - `Boolean.TRUE` ignore, Boolean.FALSE is not
Returns:
  `Builder`

#### build

    public QueryParam build()
                     throws ParamException

Verifies parameters and creates a new `QueryParam` instance.

Returns:
  `QueryParam`
Throws:
  `ParamException`