THIS IS ARCHIVED DOCUMENTATION

(Deprecated) DateFacet

The DateFacet controller makes it possible to create a facet with date ranges.

Methods

deselectAll

Deselects all facet values.

isSortedBy

Checks whether the facet values are sorted according to the specified criterion.

Parameters

  • criterion: 'ascending' | 'descending'

    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

Returns boolean: Whether the specified facet value is selected.

sortBy

Sorts the facet values according to the specified criterion.

Parameters

  • criterion: 'ascending' | 'descending'

    The criterion to sort values by.

toggleSelect

Toggles the specified facet value.

Parameters

subscribe

Adds a callback that will be called on state change.

Parameters

  • listener: () ⇒ void

    A callback to be invoked on state change.

Returns Unsubscribe: An unsubscribe function to remove the listener.

Attributes

state

The state of the DateFacet controller.

Properties

  • facetId: string

    The facet ID.

  • hasActiveValues: boolean

    true if there’s at least one non-idle value and false otherwise.

  • isLoading: boolean

    true if a search is in progress and false otherwise.

  • sortCriterion: 'ascending' | 'descending'

    The active sortCriterion of the facet.

  • values: DateFacetValue[]

    The values of the facet.

Initialize

buildDateFacet

Creates a DateFacet controller instance.

Parameters

  • engine: Engine<ConfigurationSection & SearchSection & DateFacetSection>

    The headless engine.

  • props: DateFacetProps

    The configurable DateFacet controller properties.

Returns DateFacet

DateFacetProps

The configurable DateFacet controller properties.

Properties

DateFacetOptions

The options for the DateFacet controller.

Properties

  • field: string

    The field whose values you want to display in the facet.

  • generateAutomaticRanges: boolean

    Whether the index should automatically create range values.

    Tip: If you set this parameter to true, you should ensure that the 'Use cache for numeric queries' option is enabled for this facet’s field in your index in order to speed up automatic range evaluation.

  • currentValues?: DateRangeRequest[]

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

    If generateAutomaticRanges is false, values must be specified. If generateAutomaticRanges is true, automatic ranges are going to be appended after the specified values.

    Default: []

  • facetId?: string

    A unique identifier for the controller. By default, a unique random identifier is generated.

  • filterFacetCount?: boolean

    Whether to exclude folded result parents when estimating the result count for each facet value.

    Default: true

  • injectionDepth?: number

    The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.

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

    Minimum: 0

    Default: 1000

  • numberOfValues?: number

    The number of values to request for this facet. Also determines the number of additional values to request each time this facet is expanded, and the number of values to display when this facet is collapsed.

    Minimum: 1

    Default: 8

  • sortCriteria?: 'ascending' | 'descending'

    The sort criterion to apply to the returned facet values.

    Default: ascending

Utils

buildDateRange

Creates a DateRangeRequest.

Parameters

Returns DateRangeRequest: The options defining a value to display in a DateFacet.

DateFacetValue

Properties

  • end: string

    The ending value for the date range, formatted as YYYY/MM/DD@HH:mm:ss.

  • endInclusive: boolean

    Whether or not the end value is included in the range.

  • numberOfResults: number

    The number of results having the facet value.

  • start: string

    The starting value for the date range, formatted as YYYY/MM/DD@HH:mm:ss.

  • state: 'idle' | 'selected'

    The state of the facet value, indicating whether it is filtering results (selected) or not (idle).

DateRangeOptions

Properties

  • end: string | number | Date

    The end value of the range.

  • start: string | number | Date

    The start value of the range.

  • dateFormat?: string

    Allows specifying a custom string date format. See Day.js for possible parsing tokens. Assumes ISO 8601 format by default.

  • endInclusive?: boolean

    Whether to include the end value in the range.

    Default: false

  • state?: 'idle' | 'selected'

    The current facet value state.

    Default: idle

  • useLocalTime?: boolean

    If true, the date will be returned unshifted. If false, the date will be adjusted to UTC time.

    Default: false

DateRangeRequest

Properties

  • end: string

    The end value of the range, formatted as YYYY/MM/DD@HH:mm:ss.

  • endInclusive: boolean

    Whether to include the end value in the range.

  • start: string

    The start value of the range, formatted as YYYY/MM/DD@HH:mm:ss.

  • state: 'idle' | 'selected'

    The current facet value state.

Unsubscribe

Call signatures

  • (): void