import { Router, ActivatedRoute } from '@angular/router'; import { QueryBuilder, IQueryResult, IQueryFacetInfo, IQueryFacetInfoMap, IQueryGenericResult, IQueryGenericFacets, QueryResponse } from '@relevance/core'; import { QueryService } from '@relevance/angular-core'; import { SearchServiceConfig } from './search.config'; import { ISearchParams, ISearchFilter, ISearchResponse, ISearchQueryPipe, ISearchApplyPipe } from './search.model'; /** * This service provides an easy way to implement semantic/search navigation. */ export declare class SearchService { private router; private route; private queryService; private config; private suggester; private searcher; private params; private offsetValue; private queryPipe; private applyPipe; response: QueryResponse; items: R[]; constructor(router: Router, route: ActivatedRoute, queryService: QueryService, config: SearchServiceConfig); /** * Reload the response and results based on the current parameters. */ private reload; /** * Set a parameter. */ private setParameter; /** * Get the query service instance. */ getQueryService(): QueryService; /** * Check if a request is running. */ isRunning(type?: 'search' | 'suggest'): boolean; /** * Save the context to the browser's query string. */ applyContext(params?: ISearchParams): ISearchParams; /** * Get the query mode. */ get mode(): 'filter' | 'boost' | 'mixed'; /** * Set the query mode. */ set mode(value: 'filter' | 'boost' | 'mixed'); /** * Get the query string. */ get queryString(): string | undefined; /** * Set the query string. */ set queryString(value: string | null); /** * Get the list of applied filters. */ get filters(): ISearchFilter[]; /** * Set the list of applied filters. */ set filters(items: ISearchFilter[]); /** * Get the sorting field. */ get sortField(): string | undefined; /** * Set the sorting field. */ set sortField(value: string | null); /** * Get the sorting order. */ get sortOrder(): 'asc' | 'desc'; /** * Set the sorting order. */ set sortOrder(value: 'asc' | 'desc'); /** * Get the current result offset. */ get offset(): number; /** * Set the current result offset. Is not available with forceSlice. */ set offset(value: number | null); /** * Get the current result limit. */ get limit(): number; /** * Set the current result limit. Is not available ith forceSlice. */ set limit(value: number | null); /** * Build a query builder object for a specific set of options. */ buildQuery(params?: ISearchParams, returnOnly?: 'results' | 'facets'): QueryBuilder; /** * Set the query pipe handler. */ onQuery(handler: ISearchQueryPipe): SearchService; /** * Set the apply pipe handler. */ onApply(handler: ISearchApplyPipe): SearchService; /** * Get facets of a specific type from the response. */ getFacetsArray(type?: string | string[]): IQueryFacetInfo[]; /** * Get facets map from the response. */ getFacetsMap(types?: string[]): IQueryFacetInfoMap; /** * Check if a filter is enabled. */ hasFilter(filter: IQueryFacetInfo | ISearchFilter): boolean; /** * Push a filter. */ pushFilter(facet: IQueryFacetInfo | ISearchFilter, negative?: boolean): SearchService; /** * Remove a filter. */ popFilter(filter: ISearchFilter): SearchService; /** * Clear all filters. */ clearFilters(): SearchService; /** * Apply the search. */ apply(forced?: boolean): Promise>; /** * Move to the next result page. */ nextPage(): Promise>; /** * Perform facet suggestion for a specific query string. */ suggest(text: string, type?: string | string[], count?: number, ignoreSelected?: boolean): Promise; /** * Abort any pending request. */ abort(): void; }