Facet (Insight Engine) (Deprecated)
Facet (Insight Engine) (Deprecated)
|
|
Headless v1 has been deprecated. We recommend using the latest version of the Coveo Headless library. |
Methods
deselectAll
Deselects all facet values.
disable
Disables the facet. In other words, prevents it from filtering results.
enable
Enables the facet. In other words, undoes the effects of disable.
isSortedBy
Checks whether the facet values are sorted according to the specified criterion.
Parameters
-
criterion:
'score' | 'alphanumeric' | 'occurrences' | 'automatic'The criterion to compare.
Returns boolean: Whether the facet values are sorted according to the specified criterion.
isValueSelected
Checks whether the specified facet value is selected.
Parameters
-
value:
FacetValueThe facet value to check.
Returns boolean: Whether the specified facet value is selected.
showLessValues
Sets the number of values displayed in the facet to the originally configured value.
showMoreValues
Increases the number of values displayed in the facet to the next multiple of the originally configured value.
sortBy
Sorts the facet values according to the specified criterion.
Parameters
-
criterion:
'score' | 'alphanumeric' | 'occurrences' | 'automatic'The criterion to use for sorting values.
toggleSelect
Toggles the specified facet value.
Parameters
-
selection:
FacetValueThe facet value to toggle.
toggleSingleSelect
Toggles the specified facet value, deselecting others.
Parameters
-
selection:
FacetValueThe facet value to toggle.
subscribe
Adds a callback that’s invoked on state change.
Parameters
-
listener:
() => voidA callback that’s invoked on state change.
Returns Unsubscribe: A function to remove the listener.
Attributes
facetSearch
Provides methods to search the facet’s values.
clear
Resets the query and empties the values.
search
Performs a facet search.
select
Selects a facet search result.
Parameters
-
value:
SpecificFacetSearchResultThe search result to select.
showMoreResults
Shows more facet search results.
singleSelect
Selects a search result while deselecting facet values.
Parameters
-
value:
SpecificFacetSearchResultThe search result to select.
updateCaptions
Updates the facet value captions.
Parameters
-
captions:
Record<string, string>A dictionary that maps index field values to facet value display names.
updateText
Updates the facet search query.
Parameters
-
text:
stringThe query to search.
state
The state of the Facet controller.
Properties
-
facetSearch:
FacetSearchStateThe state of the facet’s searchbox.
-
canShowLessValues:
booleantrueif fewer values can be displayed andfalseotherwise. -
canShowMoreValues:
booleantrueif there are more values to display andfalseotherwise. -
enabled:
booleanWhether the facet is enabled and its values are used to filter search results.
-
facetId:
stringThe facet ID.
-
hasActiveValues:
booleantrueif there’s at least one non-idle value andfalseotherwise. -
isLoading:
booleantrueif a search is in progress andfalseotherwise. -
sortCriterion:
'score' | 'alphanumeric' | 'occurrences' | 'automatic'The active sortCriterion of the facet.
-
values:
FacetValue[]The values of the facet.
Initialize
buildFacet
Creates an insight Facet controller instance.
Parameters
-
engine:
InsightEngineThe insight engine.
-
props:
FacetProps<FacetOptions>The configurable
Facetproperties.
Returns Facet
FacetProps<FacetOptions>
The configurable Facet properties.
Properties
-
options:
OptionsThe options for the
Facetcontroller.
Related types
FacetSearchState
Properties
-
isLoading:
booleantrueif the facet search is in progress andfalseotherwise. -
moreValuesAvailable:
booleanWhether more values are available.
-
query:
stringThe current query in the facet search box.
-
values:
SpecificFacetSearchResult[]The facet search results.
FacetValue
Properties
-
numberOfResults:
numberThe number of results that have the facet value.
-
state:
'idle' | 'selected'Whether a facet value is filtering results (
selected) or not (idle). -
value:
stringThe facet value.
SpecificFacetSearchResult
Properties
-
count:
numberAn estimate of the number of result items matching both the current query and the filter expression that would get generated if the facet value were selected.
-
displayValue:
stringThe custom facet value display name, as specified in the
captionsargument of the facet request. -
rawValue:
stringThe original facet value, as retrieved from the field in the index.
Unsubscribe
Call signatures
-
(): void