# Interface IFacetRequest

A Search API facet request.

## Index

### Properties

- basePath
- currentValues
- delimitingCharacter
- facetId
- field
- filterByBasePath
- filterFacetCount
- freezeCurrentValues
- generateAutomaticRanges
- injectionDepth
- isFieldExpanded
- numberOfValues
- preventAutoSelect
- sortCriteria
- type

## Properties

### Optional basePath

basePath: string[]

- Defined in rest/Facet/FacetRequest.ts :207

The base path shared by all values for a given hierarchical facet.

Default (Search API): `[]`

### Optional currentValues

currentValues: IFacetRequestValue[]

- Defined in rest/Facet/FacetRequest.ts :161

The values displayed by the facet in the search interface at the moment of the request.

See IFacetRequestValue.

Default (Search API): `[]`

### Optional delimitingCharacter

delimitingCharacter: string

- Defined in rest/Facet/FacetRequest.ts :193

The character to use to split field values into a hierarchical sequence.

Example: For a multi-value field containing the following values: `c; c&gt;folder2; c&gt;folder2&gt;folder3;` The delimiting character is `&gt;`.

Default (Search API): `;`

### facetId

facetId: string

- Defined in rest/Facet/FacetRequest.ts :80

The unique identifier of the facet in the search interface.

Note: Must match `^[A-Za-z0-9-_]{1,60}$`.

Example: `author-1`

### field

field: string

- Defined in rest/Facet/FacetRequest.ts :90

Required (Search API). The name of the field on which to base the facet request.

Note: Must reference an index field whose Facet option is enabled.

Example: `author`

### Optional filterByBasePath

filterByBasePath: boolean

- Defined in rest/Facet/FacetRequest.ts :216

Whether to use the [`basePath`]{@link FacetRequest.basePath} as a filter for the results.

Note: This parameter is ignored unless the facet [`type`]{@link FacetRequest.type} is `hierarchical`.

Default (Search API): `true`

### Optional filterFacetCount

filterFacetCount: boolean

- Defined in rest/Facet/FacetRequest.ts :200

Whether to exclude folded result parents when estimating result counts for facet values.

Default (Search API): `true`

### Optional freezeCurrentValues

freezeCurrentValues: boolean

- Defined in rest/Facet/FacetRequest.ts :151

Whether to include the facet request's `currentValues` in the corresponding facet response's `values` array.

Note: Setting this to `true` is useful to ensure that the facet does not move around while the end-user is interacting with it in the search interface.

Default (Search API): `false`

### Optional generateAutomaticRanges

generateAutomaticRanges: boolean

- Defined in rest/Facet/FacetRequest.ts :182

Whether to automatically generate range values for the facet.

Notes:

- Setting this to `true` is only effective when `type` is set to [`dateRange`]{@link FaceType.dateRange} or `numericalRange`, and the referenced `field` is of a corresponding type (i.e., date or numeric).
- Automatic range generation will fail if the referenced `field` is dynamically generated by a query function.
- Enabling the Use cache for numeric queries option on the referenced `field` will speed up automatic range generation (see Add or Edit Fields).

Default (Search API): `false`

### Optional injectionDepth

injectionDepth: number

- Defined in rest/Facet/FacetRequest.ts :137

The maximum number of items to scan for facet values.

Note: A high `injectionDepth` may negatively impact the facet request performance.

Default (Search API): `1000`

### Optional isFieldExpanded

isFieldExpanded: boolean

- Defined in rest/Facet/FacetRequest.ts :169

Whether the facet is expanded in the search interface at the moment of the request.

Default (Search API): `false`

### Optional numberOfValues

numberOfValues: number

- Defined in rest/Facet/FacetRequest.ts :127

The maximum number of facet values to fetch.

Note: If `freezeCurrentValues` is `true`, `numberOfValues` must be equal to the `currentValues` array length.

Default (Search API): `8`

### Optional preventAutoSelect

preventAutoSelect: boolean

- Defined in rest/Facet/FacetRequest.ts :223

Whether to prevent Coveo ML from automatically selecting values from that facet.

Default: `false`

### Optional sortCriteria

sortCriteria: FacetSortCriteria | FacetRangeSortOrder

- Defined in rest/Facet/FacetRequest.ts :115

The sort criterion to apply to the returned facet values.

Default behaviour when `type` is set to [`specific`]{@link FaceType.Specific} or [`hierarchical`]{@link FaceType.Hierarchical} (Search API):

- When `isFieldExpanded` is `false` in the facet request, and `moreValuesAvailable` is `true` in the corresponding facet response, use `score`.
- Otherwise, use `alphanumeric`.

Default (Search API) when `type` is set to [`dateRange`]{@link FaceType.dateRange} or `numericalRange` (Search API):: `ascending` Other possible value: `descending`

### Optional type

type: FacetType

- Defined in rest/Facet/FacetRequest.ts :97

The kind of values to request for the facet.

Default (Search API): [`Specific`]{@link FacetType.Specific}

### Hierarchy

- IFacetRequest