Support Menu

Coveo component HierarchicalFacet

Coveo HierarchicalFacet Component (CoveoHierarchicalFacet)

deprecated

This component is exposed for legacy reasons. Instead, use the {@link CategoryFacet} component, which is more performant and easier to use.

The HierarchicalFacet component inherits all of its options and behaviors from the Facet component, but is meant to be used to render hierarchical values.

Note:

The HierarchicalFacet component does not support the customSort Facet option.

The HierarchicalFacet component can be used to display files in a file system, or categories for items in a hierarchy.

This facet requires a group by field with a special format to work correctly.

Example:

You have the following files indexed on a file system:

c:\
  folder1\
    text1.txt
  folder2\
    folder3\
      text2.txt

The text1.txt item would have a field with the following format: c; c|folder1;

The text2.txt item would have a field with the following format: c; c|folder2; c|folder2|folder3;

By default, the | character determines the hierarchy (folder3 inside folder2 inside c).

Since both items contain the c value, selecting it value in the facet would return both items.

Selecting the folder3 value in the facet would only return the text2.txt item.

not supported in

Coveo for Salesforce Free

Index

Methods

close

  • close(value: FacetValue | IValueHierarchy | string): void

collapse

  • collapse(): void

debugInfo

  • debugInfo(): any

deselectMultipleValues

  • deselectMultipleValues(values: FacetValue[] | string[], deselectChildren?: boolean): void
  • Deselects multiple values.

    Parameters

    • values: FacetValue[] | string[]

      The array of values to deselect.

    • Default value deselectChildren: boolean = !this.options.useAnd

      Specifies whether to also deselect all child values (if any). Default value is the opposite of the useAnd option value set for this HierarchicalFacet.

    Returns void

deselectValue

  • deselectValue(value: FacetValue | string, deselectChildren?: boolean): void

disable

  • disable(): void
  • Disable the component. Normally this means that the component will not execute handlers for the framework events (query events, for example). Component are enabled by default on creation.

    Returns void

enable

  • enable(): void
  • Enable the component. Normally this means that the component will execute handlers for the framework events (query events, for example). Components are enabled by default on creation.

    Returns void

excludeMultipleValues

  • excludeMultipleValues(values: FacetValue[] | string[]): void

excludeValue

  • excludeValue(value: FacetValue | string, excludeChildren?: boolean): void
  • Excludes a single value.

    Parameters

    • value: FacetValue | string

      The value to exclude.

    • Default value excludeChildren: boolean = !this.options.useAnd

      Specifies whether to also exclude all child values (if any). Default value is the opposite of the useAnd option value set for this HierarchicalFacet.

    Returns void

expand

  • expand(): void

getBindings

getDisplayedFacetValues

  • getDisplayedFacetValues(): FacetValue[]

getDisplayedValues

  • getDisplayedValues(): string[]

getEndpoint

  • getEndpoint(): ISearchEndpoint

getExcludedValues

  • getExcludedValues(): string[]

getSelectedValues

  • getSelectedValues(): string[]

getValueCaption

hideWaitingAnimation

  • hideWaitingAnimation(): void

open

  • open(value: FacetValue | IValueHierarchy | string): void

reset

  • reset(): void

selectMultipleValues

  • selectMultipleValues(values: FacetValue[] | string[], selectChildren?: boolean): void
  • Selects multiple values

    Parameters

    • values: FacetValue[] | string[]

      The array of values to select.

    • Default value selectChildren: boolean = !this.options.useAnd

      Specifies whether to also select all child values (if any). Default value is the opposite of the useAnd option value set for this HierarchicalFacet.

    Returns void

selectValue

  • selectValue(value: FacetValue | string, selectChildren?: boolean): void
  • Selects a single value.

    Parameters

    • value: FacetValue | string

      The value to select.

    • Default value selectChildren: boolean = !this.options.useAnd

      Specifies whether to also select all child values (if any). Default value is the opposite of the useAnd option value set for this HierarchicalFacet.

    Returns void

showLess

  • showLess(): void

showMore

  • showMore(): void

showWaitingAnimation

  • showWaitingAnimation(): void

switchToAnd

  • switchToAnd(): void

switchToOr

  • switchToOr(): void

toggleExcludeValue

  • toggleExcludeValue(value: FacetValue | string): void

toggleSelectValue

  • toggleSelectValue(value: FacetValue | string): void

unexcludeMultipleValues

  • unexcludeMultipleValues(values: FacetValue[] | string[]): void

unexcludeValue

  • unexcludeValue(value: FacetValue | string, unexludeChildren?: boolean): void
  • Un-excludes a single value.

    Parameters

    • value: FacetValue | string

      The value to un-exclude.

    • Default value unexludeChildren: boolean = !this.options.useAnd

      Specifies whether to also un-exclude all child values (if any). Default value is the opposite of the useAnd option value set for this HierarchicalFacet.

    Returns void

updateSort

  • updateSort(criteria: string): void

Static get

  • get(element: HTMLElement, componentClass?: any, noThrow?: boolean): BaseComponent
  • Get the bound component to the given HTMLElement. Throws an assert if the HTMLElement has no component bound, unless using the noThrow argument.
    If there is multiple component bound to the current HTMLElement, you must specify the component class.

    Parameters

    • element: HTMLElement

      HTMLElement for which to get the bound component.

    • Optional componentClass: any

      Optional component class. If the HTMLElement has multiple components bound, you must specify which one you are targeting.

    • Optional noThrow: boolean

      Boolean option to tell the method to not throw on error.

    Returns BaseComponent

Properties

bind

Allows the component to bind events and execute them only when it is enabled.

type

{Coveo.ComponentEvents}

componentOptionsModel

componentOptionsModel: ComponentOptionsModel

Contains the state of options for differents component. Mainly used by ResultLink.

componentStateModel

componentStateModel: ComponentStateModel

Contains the state of different component (enabled vs disabled). Allows to get/set values. Trigger component state event when modified. Each component can listen to those events.

disabled

disabled: boolean

A disabled component will not participate in the query, or listen to ComponentEvents.

type

{boolean}

facetSearch

facetSearch: FacetSearch

Renders and handles the facet Search part of the component.

facetSettings

facetSettings: FacetSettings

Renders and handles the facet Settings part of the component

logger

logger: Logger

Allows component to log in the dev console.

queryController

queryController: QueryController

Contains the singleton that allows to trigger queries.

queryStateModel

queryStateModel: QueryStateModel

Contains the state of the query. Allows to get/set values. Trigger query state event when modified. Each component can listen to those events.

root

root: HTMLElement

A reference to the root HTMLElement (the SearchInterface).

searchInterface

searchInterface: SearchInterface

A reference to the root of every component, the SearchInterface.

usageAnalytics

usageAnalytics: IAnalyticsClient

A reference to the Analytics.client.

Static ID

ID: string

The static ID that each component need to be identified.
For example, SearchButton -> static ID : SearchButton -> className : CoveoSearchButton

Component Options

delimitingCharacter

delimitingCharacter: string

The character that allows to specify the hierarchical dependency.

Example:

If your field has the following values:

@field: c; c>folder2; c>folder2>folder3;

The delimiting character is >.

Default value is |.

Markup configuration example(s) :
data-delimiting-character='foo'

levelEnd

levelEnd: number

Specifies at which level (0-based index) of the hierarchy the HierarchicalFacet should stop displaying its values.

Default value is undefined, which means the HierarchicalFacet component renders all hierarchical levels. Minimum value is 0.

Markup configuration example(s) :
data-level-end='10'

levelStart

levelStart: number

Specifies at which level (0-based index) of the hierarchy the HierarchicalFacet should start displaying its values.

Example:

If you have the following files indexed on a file system:

c:\
   folder1\
       text1.txt
   folder2\
     folder3\
       text2.txt

Setting levelStart to 1 displays folder1 and folder2 in the HierarchicalFacet, but omits c:.

Default (and minimum) value is 0.

Markup configuration example(s) :
data-level-start='10'

marginByLevel

marginByLevel: number

Specifies the margin (in pixels) to display between each hierarchical level when expanding.

Default value is 10.

Markup configuration example(s) :
data-margin-by-level='10'

Constructors

constructor

  • Creates a new HierarchicalFacet component.

    Parameters

    • element: HTMLElement

      The HTMLElement on which to instantiate the component.

    • options: IHierarchicalFacetOptions

      The options for the HierarchicalFacet component.

    • bindings: IComponentBindings

      The bindings that the component requires to function normally. If not set, these will be automatically resolved (with a slower execution time).

    Returns HierarchicalFacet

Implements