1. Search Developer

The Facet interface

In Sitecore Search, content can be displayed in facets. A facet is a dynamic search interface component that creates categories based on attribute values. With facets, users can easily filter search results using the categories.

Facet interface

Name

Type

Description

all

boolean

Requests all facet types.

max

number

Maximum number of facet types.

sort

FacetSort

Sorting order requested.

types

Array<FacetType>

List of facet types.

FacetSort interface

Name

Type

Description

name

string

Alphabetically or numerically sort type.

text or count.

order

string

Ascending or descending sort.

asc or desc.

FacetType interface

Name

Type

Description

after

string

Name of previous facet type in list..

exclude

Array<string>

Names of facet types to exclude.

filter

FacetTypeFilter

FacetTypeFilterOr or FacetTypeFilterAnd

filtering_options

Array<FacetTypeFilteringOptions>

List of FacetTypeFilteringOptions enumerator values.

FacetTypeFilteringOptions.HARD_FILTERS, FacetTypeFilteringOptions.OTHER_FACET_VALUES, and    FacetTypeFilteringOptions.OWN_VALUES

keyphrase

string

Phrase to search.

max

number

Maximum number of facet types to return.

min_count

number

Minimum number of facet types to return.

name

string

Name of facet type.

sort

Array<Sort>

List of sorting options for the facet type.

Sort interface

Name

Type

Description

choices

boolean

Flag to request a list of all sort options in the response.

true or false

value

SortItem

Object describing how items are sorted.

SortItem interface

Name

Type

Description

name

string

Alphabetically or numerically sort type.

text or count.

order

string

Ascending or descending sort.

asc or desc.

Note

Unless indicated otherwise, all values are optional.

The following code block lists the various methods related to facets and is accessible through the WidgetRequest object. After the installation of the JS Data package into your project, these methods and their documentation are available in your IDE.

/** search.facet */
getSearchFacet(): Facet;
setSearchFacet(value: Facet): IWidgetItem;
resetSearchFacet(): IWidgetItem;
updateSearchFacet(value: Facet): IWidgetItem;

/** search.facet.all */
getSearchFacetAll(): boolean;
setSearchFacetAll(value: boolean): IWidgetItem;
resetSearchFacetAll(): IWidgetItem;

/** search.facet.max */
getSearchFacetMax(): number;
setSearchFacetMax(value: number): IWidgetItem;
resetSearchFacetMax(): IWidgetItem;

/** search.facet.sort */
getSearchFacetSort(): FacetSort;
setSearchFacetSort(value: FacetSort): IWidgetItem;
resetSearchFacetSort(): IWidgetItem;
updateSearchFacetSort(value: FacetSort): IWidgetItem;

/** search.facet.sort.name */
getSearchFacetSortName(): string;
setSearchFacetSortName(value: string): IWidgetItem;
resetSearchFacetSortName(): IWidgetItem;

/** search.facet.sort.order */
getSearchFacetSortOrder(): string;
setSearchFacetSortOrder(value: string): IWidgetItem;
resetSearchFacetSortOrder(): IWidgetItem;

/** search.facet.types */
getSearchFacetTypes(): Array<FacetType>;
setSearchFacetTypes(value: Array<FacetType>): IWidgetItem;
resetSearchFacetTypes(): IWidgetItem;
addSearchFacetType(value: FacetType): IWidgetItem;
removeSearchFacetType(value: FacetType, filter?: (v: any) => boolean): IWidgetItem;
If you have suggestions for improving this article, let us know!