import { FacetType, Filter, Query } from './types'; /** * Associate {@link Query} objects with each other in a filtered search setup, using {@link Filter} definitions. * * Instances of this class respresent search pages with filters and/or modifiers (such as sorting). */ export declare class FilteredSearch { /** * 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. */ private searchQuery; /** * emptyParameterQuery is used instead of searchQuery when the searchQuery parameters are all empty. * If no emptyParameterQuery is passed, searchQuery is fetched with empty parameters. */ private emptyParameterQuery?; /** * Optional list of allowed modifiers. If not given, all modifiers will be allowed. */ private modifiers?; protected _filters: Filter[]; private _modifiers?; private _activeModifier?; constructor( /** * 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. */ searchQuery: 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. */ emptyParameterQuery?: Query | undefined, /** * Optional list of allowed modifiers. If not given, all modifiers will be allowed. */ modifiers?: Query[] | undefined); /** * Add a facet to the FilteredSearch object. */ addFacet(endpoint: string, type?: FacetType, resetOnQueryChange?: boolean, filterEndpointPostfix?: string, filterEndpointParameterName?: string): void; addSimpleFilter(filterEndpoint: string): void; addParameterizedFilter(filterEndpoint: string, resetOnQueryChange?: boolean, filterParameterName?: string): void; /** * Add a filter to the {@link FilteredSearch} object. * * @param obj the Filter to be added or a {@link Query} object, from which a * {@link SimpleFilter} or {@link ParameterizedFilter} will be deduced */ addFilter(obj: Query | Filter): void; get filters(): Filter[]; /** * Set a {@link Query} as modifier. Only modifiers in the list passed to constructor are allowed. */ setModifier(modifier: Query | undefined): void; /** * Get the currently active modifier {@link Query}. */ getModifier(): Query | undefined; /** * Get the {@link 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. */ getBaseQuery(): Query; /** * Get the Query objects to retrieve search results. This includes the facet Query, if applicable. */ getResultsQuery(excludeModifier?: boolean): Query[]; /** * Get the Query objects to retrieve the facet options. * * @param facetEndpoint name of the facet endpoint to fetch options for * @param excludeModifier will skip applying the active modifier * @param includeSelf keep the active facet filter for which options should be fetched in the query stack. Use when requesting RequestType.Options */ getFacetQuery(facetEndpoint: string, excludeModifier?: boolean, includeSelf?: boolean): Query[]; /** * Set a parameter value for the searchQuery */ setParameter(name: string, value: string): void; /** * Clear all searchQuery parameters */ clearParameters(): void; /** * Set the selected options for a given filter or facet. */ setFilterSelection(endpoint: string, selection: undefined | null | (string | number) | (string | number)[] | (string | number)[][]): void; /** * Clear the selection for all or a given filter. */ clearFilterSelection(endpoint?: string): void; setSearchQuery(query: Query): void; /** * Overwrite the entire state with the values in the passed Query stack. * * @param results typically retrieved from a URL query parameter and then parsed with `parseQueries` */ setState(results: Query[]): void; }