Class FilteredSearch

Associate Query objects with each other in a filtered search setup, using Filter definitions.

Instances of this class respresent search pages with filters and/or modifiers (such as sorting).

Hierarchy

Constructors

  • Parameters

    • searchQuery: Query

      Query object for the search results that will serve as the base for this facet. The searchQuery is used to fetch the options of the facet and will be filtered once one or more facet options are selected. The searchQuery must have at least one parameter.

    • Optional emptyParameterQuery: Query

      emptyParameterQuery is used instead of searchQuery when the searchQuery parameters are all empty. If no emptyParameterQuery is passed, searchQuery is fetched with empty parameters.

    • Optional modifiers: Query[]

      Optional list of allowed modifiers. If not given, all modifiers will be allowed.

    Returns FilteredSearch

Properties

_activeModifier?: Query
_filters: Filter[] = []
_modifiers?: Query[]
emptyParameterQuery?: Query

emptyParameterQuery is used instead of searchQuery when the searchQuery parameters are all empty. If no emptyParameterQuery is passed, searchQuery is fetched with empty parameters.

modifiers?: Query[]

Optional list of allowed modifiers. If not given, all modifiers will be allowed.

searchQuery: Query

Query object for the search results that will serve as the base for this facet. The searchQuery is used to fetch the options of the facet and will be filtered once one or more facet options are selected. The searchQuery must have at least one parameter.

Accessors

Methods

  • Add a facet to the FilteredSearch object.

    Parameters

    • endpoint: string
    • type: FacetType = FacetType.single
    • resetOnQueryChange: boolean = true
    • filterEndpointPostfix: string = ':FILTER'
    • filterEndpointParameterName: string = 'value'

    Returns void

  • Parameters

    • filterEndpoint: string
    • resetOnQueryChange: boolean = true
    • filterParameterName: string = 'value'

    Returns void

  • Parameters

    • filterEndpoint: string

    Returns void

  • Clear the selection for all or a given filter.

    Parameters

    • Optional endpoint: string

    Returns void

  • Get the Query to get the search results. Will return searchQuery as passed to the constructor unless a emptyParameterQuery was also passed and all parameters for searchQuery are empty.

    Returns Query

  • Get the Query objects to retrieve the facet options.

    Parameters

    • facetEndpoint: string

      name of the facet endpoint to fetch options for

    • excludeModifier: boolean = false

      will skip applying the active modifier

    • includeSelf: boolean = false

      keep the active facet filter for which options should be fetched in the query stack. Use when requesting RequestType.Options

    Returns Query[]

  • Get the Query objects to retrieve search results. This includes the facet Query, if applicable.

    Parameters

    • excludeModifier: boolean = false

    Returns Query[]

  • Set the selected options for a given filter or facet.

    Parameters

    • endpoint: string
    • selection: undefined | null | string | number | (string | number)[] | (string | number)[][]

    Returns void

  • Set a Query as modifier. Only modifiers in the list passed to constructor are allowed.

    Parameters

    • modifier: undefined | Query

    Returns void

  • Set a parameter value for the searchQuery

    Parameters

    • name: string
    • value: string

    Returns void

  • Overwrite the entire state with the values in the passed Query stack.

    Parameters

    • results: Query[]

      typically retrieved from a URL query parameter and then parsed with parseQueries

    Returns void

Generated using TypeDoc