Support Menu

Coveo component HierarchicalFacet

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

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

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

Example:

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

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

The document text1.txt would need to have a field with the following format: @field : c; c|folder1;

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

The | character allows the facet to build its hierarchy (folder3 inside folder2 inside c).

Since both documents contain the c value, selecting that value in the facet would return both documents.

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

Index

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;

Then your 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

Then, 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'

Methods

close

collapse

  • collapse(): void

debugInfo

  • debugInfo(): any

deselectMultipleValues

  • deselectMultipleValues(values: FacetValue[], deselectChildren?: boolean): void

deselectValue

  • deselectValue(value: FacetValue, 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[]): void

excludeValue

  • excludeValue(value: FacetValue, excludeChildren?: boolean): void

expand

  • expand(): void

getBindings

getDisplayedFacetValues

getDisplayedValues

  • getDisplayedValues(): string[]

getEndpoint

  • getEndpoint(): ISearchEndpoint

getExcludedValues

  • getExcludedValues(): string[]

getSelectedValues

  • getSelectedValues(): string[]

getValueCaption

hideWaitingAnimation

  • hideWaitingAnimation(): void

open

reset

  • reset(): void

selectMultipleValues

  • selectMultipleValues(values: FacetValue[], selectChildren?: boolean): void

selectValue

  • selectValue(value: FacetValue, selectChildren?: boolean): void

showLess

  • showLess(): void

showMore

  • showMore(): void

showWaitingAnimation

  • showWaitingAnimation(): void

switchToAnd

  • switchToAnd(): void

switchToOr

  • switchToOr(): void

toggleExcludeValue

toggleSelectValue

unexcludeMultipleValues

  • unexcludeMultipleValues(values: FacetValue[]): void

unexcludeValue

  • unexcludeValue(value: FacetValue, unexludeChildren?: boolean): 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

Constructors

constructor

Implements