Class FacetRequest.Builder (2.0.0)

public static final class FacetRequest.Builder

A facet request builder. Each facet request should at least have the name of the facet. It can also includes number of values, a list of constraints on the values or a list of ranges for numeric facets. Note that the list of constraints and the list of ranges are mutually exclusive, i.e. you can specify one of them but not both.

Inheritance

java.lang.Object > FacetRequest.Builder

Methods

addRange(FacetRange range)

public FacetRequest.Builder addRange(FacetRange range)

Adds a FacetRange to this request. Note that ranges and value constraints are mutually exclusive. Either of them can be provided, but not both for the same request.

Parameter
Name Description
range FacetRange
Returns
Type Description
FacetRequest.Builder

this Builder

addValueConstraint(String constraint)

public FacetRequest.Builder addValueConstraint(String constraint)

Adds a value constraint to this facet request. Note that ranges and value constraints are mutually exclusive. Either of them can be provided, but not both for the same request.

Parameter
Name Description
constraint String
Returns
Type Description
FacetRequest.Builder

this Builder

build()

public FacetRequest build()

Construct the final message.

Returns
Type Description
FacetRequest

the FacetRequest built from the parameters entered on this Builder

setName(String name)

public FacetRequest.Builder setName(String name)

Sets the name of the facet for this request.

Parameter
Name Description
name String
Returns
Type Description
FacetRequest.Builder

this Builder

setValueLimit(int valueLimit)

public FacetRequest.Builder setValueLimit(int valueLimit)

Sets the maximum number of values for this facet to return.

Parameter
Name Description
valueLimit int
Returns
Type Description
FacetRequest.Builder

this Builder