# Class FacetRequest.Builder (5.0.3)

    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](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> FacetRequest.Builder

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Methods

### addRange(FacetRange range)

    public FacetRequest.Builder addRange(FacetRange range)

Adds a [FacetRange](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.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` | `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.FacetRange` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.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` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.FacetRequest.Builder` | this Builder |

### build()

    public FacetRequest build()

Construct the final message.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.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` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.FacetRequest.Builder` | this Builder |