import * as i0 from '@angular/core'; import { OnDestroy, InjectionToken, OnChanges, SimpleChanges, EventEmitter, AfterViewInit, OnInit, ElementRef, ModuleWithProviders } from '@angular/core'; import { Router, Params } from '@angular/router'; import { Subscription, Subject, BehaviorSubject, Observable } from 'rxjs'; import * as i12 from '@sinequa/core/web-services'; import { Results, Record, Aggregation, QueryWebService, AuditWebService, QueryIntentWebService, CCTab, IQuery, AuditEvent, QueryIntentData, AuditEvents, IMulti, ListAggregation, TreeAggregation, DidYouMeanKind, Tab, AuditEventType, AuditEventTypeValues, QueryIntent, QueryIntentMatch, QueryAnalysis, QueryIntentAction, DidYouMeanItem, DidYouMeanAction, CCScope } from '@sinequa/core/web-services'; import { Query, AppService, FormatService, ValueItem } from '@sinequa/core/app-utils'; import { NotificationsService } from '@sinequa/core/notification'; import * as i14 from '@sinequa/core/login'; import { LoginService } from '@sinequa/core/login'; import * as i13 from '@sinequa/core/intl'; import { IntlService } from '@sinequa/core/intl'; import { UserPreferences } from '@sinequa/components/user-settings'; import * as i16 from '@sinequa/components/action'; import { Action, IAction } from '@sinequa/components/action'; import * as i10 from '@angular/common'; import * as i11 from '@angular/forms'; import * as i15 from '@sinequa/components/utils'; interface SearchOptions { /** Name of routes for which we want the search service to work (incl. storing the query in the URL) */ routes?: string[]; /** Name of routes for which we want the search service to work, but no actual search query to be performed. This can be used to perform custom actions on certain routes */ skipSearchRoutes?: string[]; /** Name of the home route, if any */ homeRoute?: string; /** Deactivate the storing of the query in the URL (calling search() then directly triggers a search and causes no URL modification or routing event) */ deactivateRouting?: boolean; /** Force the global query to always be appService.ccquery */ preventQueryNameChanges?: boolean; /** Whether to detect query intents synchronously (blocking the execution of the query until we know the intent). By default, query intents are detected asynchronously. */ queryIntentsSync?: boolean; /** A function that test whether 2 records should be considered duplicates */ testDuplicates?: (a: Record, b: Record) => boolean; /** A function called when results are received from the server; can be used to post-process results before they are displayed */ initializeResults?: (query: Query, results: Results) => void; /** A function called when a record is received from the server; can be used to post-process a record before it is displayed */ initializeRecord?: (query: Query, record: Record) => void; /** A function called when an aggregation is received from the server; can be used to post-process an aggregation before it is displayed */ initializeAggregation?: (query: Query, aggregation: Aggregation) => void; } declare const SEARCH_OPTIONS: InjectionToken; declare class SearchService implements OnDestroy { protected options: SearchOptions; protected router: Router; protected appService: AppService; protected queryService: QueryWebService; protected loginService: LoginService; protected intlService: IntlService; protected formatService: FormatService; protected auditService: AuditWebService; protected notificationsService: NotificationsService; protected queryIntentWebService: QueryIntentWebService; protected _query: Query | undefined; queryStringParams: Params; results: T | undefined; searchActive: boolean; protected loginSubscription: Subscription; protected routerSubscription: Subscription; protected appSubscription: Subscription; protected fetchingLoadMore: boolean; protected _events: Subject>; protected _queryStream: BehaviorSubject; protected _resultsStream: BehaviorSubject; protected userPreferences: UserPreferences; constructor(options: SearchOptions, router: Router, appService: AppService, queryService: QueryWebService, loginService: LoginService, intlService: IntlService, formatService: FormatService, auditService: AuditWebService, notificationsService: NotificationsService, queryIntentWebService: QueryIntentWebService); ngOnDestroy(): void; get events(): Observable>; get queryStream(): Observable; get resultsStream(): Observable; getTabConfig(name: string): CCTab | undefined; get query(): Query; setQuery(query: Query | undefined, newQuery?: boolean): void; clearQuery(): void; private _setResults; setResults(results: T): void; private treatQueryIntents; get haveRecords(): boolean; get rowCount(): number; get totalRowCount(): number; get pageSize(): number; get page(): number; get pageCount(): number; makeQuery(recentQuery?: Partial | Query): Query; protected makeAuditEvent(event: AuditEvent): AuditEvent; clear(navigate?: boolean, path?: string): void; home(path?: string | undefined): void; protected makeQueryIntentData(queryIntentData: QueryIntentData): QueryIntentData; isEmptySearchIgnoreSelects(query: Query | undefined): boolean; isEmptySearch(query: Query | undefined): boolean; checkEmptySearch(queries: Query | Query[]): boolean; getResults(query: Query, auditEvents?: AuditEvents, options?: SearchService.GetResultsOptions): Observable; getMultipleResults(queries: Query[], auditEvents?: AuditEvents): Observable>; /** * Initializes the client-side fields of the Results object * @param results */ initializeResults(query: Query, results: Results): void; initializeRecords(query: Query, results: Results): void; initializeAggregations(query: Query, results: Results): void; initializeAggregation(aggregation: ListAggregation): void; initializeTreeAggregation(aggregation: TreeAggregation): void; navigate(options?: SearchService.NavigationOptions, audit?: AuditEvents): Promise; protected getHistoryState(): SearchService.HistoryState; isSearchRouteActive(): boolean; protected isSearchRoute(pathname: string): boolean; protected isSkipSearchRoute(pathname: string): boolean; private checkSearchRoute; getQueryFromUrl(): Query | undefined; protected ensureQueryFromUrl(): Query | undefined; protected handleLogin(): void; get routingActive(): boolean; set routingActive(value: boolean); protected handleNavigation(navigationOptions?: SearchService.NavigationOptions, audit?: AuditEvents): void; pipeQueryIntent(obs: Observable): Observable; search(navigationOptions?: SearchService.NavigationOptions, audit?: AuditEvents): Promise; searchText(path?: string): Promise; gotoPage(page: number): Promise; /** * Load more results and append them to previous results */ loadMore(): void; /** * @returns true if more are available otherwise false */ hasMore(): boolean; didYouMean(text: string, kind: DidYouMeanKind): Promise; getCurrentRecordIds(): string[]; getRecordFromId(id: string): Record | undefined; addFieldSelect(field: string, items: ValueItem | ValueItem[], options?: SearchService.AddSelectOptions): boolean; selectTab(arg: string | Tab, options?: SearchService.NavigationOptions): Promise; selectScope(scope: string): void; getTab(tabName: string): Tab | undefined; getCurrentTab(): Tab | undefined; notifyOpenOriginalDocument(record: Record, resultId?: string, type?: AuditEventType | AuditEventTypeValues): void; checkBeforeSearch(cancelReasons?: string[]): boolean; /** * Get the records according to a list of ID * * They are first searched on the result records, and we make a query for those we cannot find */ getRecords(ids: string[]): Observable<(Record | undefined)[]>; static ɵfac: i0.ɵɵFactoryDeclaration, [{ optional: true; }, null, null, null, null, null, null, null, null, null]>; static ɵprov: i0.ɵɵInjectableDeclaration>; } declare namespace SearchService { interface GetResultsOptions { queryIntents?: QueryIntent[]; queryIntentsV2?: QueryIntentMatch[]; queryAnalysis?: QueryAnalysis; searchInactive?: boolean; } interface AddSelectOptions { not?: boolean; and?: boolean; } interface NavigationOptions { path?: string; selectTab?: boolean; analyzeQueryText?: boolean; queryIntents?: QueryIntent[]; queryAnalysis?: QueryAnalysis; skipLocationChange?: boolean; skipSearch?: boolean; } interface HistoryState { audit?: AuditEvents; navigationOptions?: NavigationOptions; } interface Event { type: "new-query" | "update-query" | "make-query" | "before-new-results" | "new-results" | "make-query-intent-data" | "process-query-intent-action" | "make-audit-event" | "new-query-intents" | "before-select-tab" | "after-select-tab" | "clear" | "open-original-document" | "before-search"; } interface NewQueryEvent extends Event { type: "new-query"; query: Query | undefined; } interface UpdateQueryEvent extends Event { type: "update-query"; query: Query | undefined; } interface MakeQueryEvent extends Event { type: "make-query"; query: Query; } interface BeforeNewResultsEvent extends Event { type: "before-new-results"; results: T | undefined; } interface NewResultsEvent extends Event { type: "new-results"; results: T | undefined; } interface MakeQueryIntentDataEvent extends Event { type: "make-query-intent-data"; intentData: QueryIntentData; } interface ProcessQueryIntentActionEvent extends Event { type: "process-query-intent-action"; action: QueryIntentAction; intent: QueryIntent; analysis: QueryAnalysis; actionProcessed?: boolean; } interface MakeAuditEventEvent extends Event { type: "make-audit-event"; event: AuditEvent; } interface BeforeSelectTabEvent extends Event { type: "before-select-tab"; query: Query; } interface AfterSelectTabEvent extends Event { type: "after-select-tab"; observable: Observable; } interface ClearEvent extends Event { type: "clear"; path?: string; } interface OpenOriginalDocument extends Event { type: "open-original-document"; record: Record; } interface BeforeSearchEvent extends Event { type: "before-search"; cancel?: boolean; cancelReasons?: string[]; } interface NewQueryIntentsEvent extends Event { type: "new-query-intents"; query: Query; intents: QueryIntentMatch[]; cancelSearch: boolean; } type Events = NewQueryEvent | UpdateQueryEvent | MakeQueryEvent | BeforeNewResultsEvent | NewResultsEvent | MakeQueryIntentDataEvent | ProcessQueryIntentActionEvent | MakeAuditEventEvent | BeforeSelectTabEvent | AfterSelectTabEvent | ClearEvent | OpenOriginalDocument | BeforeSearchEvent | NewQueryIntentsEvent; const DefaultPageSize = 20; } interface FirstPageOptions { displayOnHomePage?: boolean; aggregations?: string[]; } declare const FIRST_PAGE_OPTIONS: InjectionToken; declare class FirstPageService implements OnDestroy { protected options: FirstPageOptions; protected searchService: SearchService; protected loginService: LoginService; protected router: Router; private subscriptions; firstPage?: Results; constructor(options: FirstPageOptions, searchService: SearchService, loginService: LoginService, router: Router); ngOnDestroy(): void; /** * @ignore * legacy */ get isFirstPage(): boolean; get isCurrentSearchResults(): boolean; displayOnHomePage(path?: string): boolean; /** * "If the first page is already cached, return it as an observable, otherwise, * make a query, set the isFirstPage flag to true, and then return the results * as an observable." * * @returns Observable */ getFirstPage(aggregations?: string[]): Observable; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class BsDidYouMean implements OnChanges { searchService: SearchService; results: Results; item: DidYouMeanItem | undefined; action: DidYouMeanAction | undefined; constructor(searchService: SearchService); private handleResults; /** * Resolves the action to display from the per-term `appliedChanges` reported by the engine (ES-28698). * Falls back to `spellingCorrectionMode`-based inference for engine versions prior to 11.14 that * do not report `appliedChanges`, or when the applied changes disagree on the action to take * (defaults to `suggestion`, the only case that does not assert a search behavior that may not * actually have happened — the root cause of ES-27719). */ private resolveAction; /** * Fallback for engine versions prior to 11.14 that do not report the per-term `action` (ES-28698). * Defaults to `suggestion` for unknown modes, since it is the only case that does not assert * a search behavior that may not actually have happened (the root cause of ES-27719). */ private legacyAction; ngOnChanges(changes: SimpleChanges): void; selectOriginal(): boolean; selectCorrected(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** * Component for choosing the page size of the results view * */ declare class BsPageSizeSelector implements OnChanges { private appService; private searchService; results: Results; showInRegularView: boolean; showInCustomization: boolean; pageSizes: number[]; rightAligned: boolean; _defaultPageSize: number; pageSizingAction: Action; protected availableSizes: number[]; protected currentPageSize: number; constructor(appService: AppService, searchService: SearchService); ngOnChanges(changes: SimpleChanges): void; protected get configPageSize(): number; protected get defaultPageSize(): number; protected buildPageSizingAction(): Action; protected refreshVisualisation(): void; protected setCurrentSize(size: number): void; protected updatePageSize(size: number): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsPager implements OnChanges { private searchService; results: Results; showNavigation: boolean; showFirstLast: boolean; showPages: boolean; endPages: number; pages: number; items: BsPager.Item[] | undefined; private currentPage; pageCount: number; static FIRST_PAGE: string; static PREVIOUS_PAGE: string; static NEXT_PAGE: string; static LAST_PAGE: string; static ELLIPSIS: string; constructor(searchService: SearchService); ngOnChanges(changes: SimpleChanges): void; makeItems(): void; gotoPage(page: number): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare namespace BsPager { class Item { page: number; currentPage: number; display?: string | number | undefined; title?: string | undefined; constructor(page: number, currentPage: number, display?: string | number | undefined, title?: string | undefined); get active(): boolean; get disabled(): boolean; get isNavigation(): boolean; get isPage(): boolean; get isEllipsis(): boolean; } } declare class BsSortSelector implements OnChanges { appService: AppService; searchService: SearchService; results: Results; rightAligned: boolean; style: string; size: string; sortAction: Action | undefined; constructor(appService: AppService, searchService: SearchService); ngOnChanges(changes: SimpleChanges): void; private setCurrentSort; private selectSort; private buildSortAction; private isAscendingSort; private isDescendingSort; private isTabSearch; private getSortingChoices; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsTabs implements OnChanges { private searchService; results: Results; /** * List of custom tabs (complementing the search query tabs) * Actions can be performed on click via the events Output. * * When the results are updated (new search text, facet * selection...), the custom tab selection is discarded. * If the custom action updates the results, the tab selection * will revert to previous state unless the query is updated. */ customtabs: Tab[]; /** * Tab name to select by default */ selectedTab: string; /** * Associate icon to a tab name ({tab1 : 'icon class 1', tab2 : ...}) */ iconMap: { [key: string]: string; }; showCounts: boolean; /** * Custom classes for the tab items */ tabsClass: string; /** * Emits an event when a tab is selected */ events: EventEmitter<{ name: string; value: string; count: number; display: string; }>; currentTab: Tab | undefined; searchtabs: Tab[] | undefined; constructor(searchService: SearchService); update(): void; ngOnChanges(changes: SimpleChanges): void; selectTab(tab: Tab, search?: boolean): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsLoadingBar { searchService: SearchService; /** * active can provided as a boolean to activate the loading bar. * If it is not provided, the SearchService searchActive property is used. */ active?: boolean; constructor(searchService: SearchService); isActive(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } type FloatStyle = "float-right" | "float-left-15" | "float-left-35"; declare class BsScroller implements AfterViewInit, OnDestroy, OnInit { private searchService; options: {}; position: FloatStyle; anchor: ElementRef; hasMore: boolean; private observer; constructor(searchService: SearchService); ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsLoadMore implements OnInit, OnDestroy { private searchService; buttonsStyle: string; actionsSize: string; private subscription; loadMoreAction: IAction; hasMore: boolean; constructor(searchService: SearchService); ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsScopeComponent implements OnChanges { appService: AppService; query: Query; queryChange: EventEmitter; scopeAction: Action; allScopes: CCScope; constructor(appService: AppService); ngOnChanges(changes: SimpleChanges): void; updateAction(): void; getScopeAction(scope: CCScope): Action; selectScope(scope: string): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsSearchModule { static forRoot(searchOptions: SearchOptions): ModuleWithProviders; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare const _default$2: { search: { emptySearchNotification: string; alreadyFiltered: string; }; didYouMean: { suggestionBeforeOriginal: string; suggestionBeforeCorrected: string; suggestionAfterCorrected: string; correctionBeforeCorrected: string; correctionBeforeOriginal: string; correctionAfterOriginal: string; expansionBeforeOriginal: string; expansionBeforeCorrected: string; expansionAfterCorrected: string; }; pageSizeSelector: { pageSizeChoice: string; defaultPageSize: string; defaultPageSizeChoice: string; }; pager: { pageNumberTitle: string; firstPage: string; nextPage: string; previousPage: string; lastPage: string; }; sortSelector: { sortByTitle: string; sortOther: string; }; sort: { relevance: string; date: string; filename: string; title: string; }; queryIntent: { externalServiceTimeoutError: string; }; scopes: { allScopes: string; }; }; declare const _default$1: { search: { emptySearchNotification: string; alreadySelected: string; }; didYouMean: { suggestionBeforeOriginal: string; suggestionBeforeCorrected: string; suggestionAfterCorrected: string; correctionBeforeCorrected: string; correctionBeforeOriginal: string; correctionAfterOriginal: string; expansionBeforeOriginal: string; expansionBeforeCorrected: string; expansionAfterCorrected: string; }; pageSizeSelector: { pageSizeChoice: string; defaultPageSize: string; defaultPageSizeChoice: string; }; pager: { pageNumberTitle: string; firstPage: string; nextPage: string; previousPage: string; lastPage: string; }; sortSelector: { sortByTitle: string; sortOther: string; }; sort: { relevance: string; date: string; filename: string; title: string; }; queryIntent: { externalServiceTimeoutError: string; }; scopes: { allScopes: string; }; }; declare const _default: { search: { emptySearchNotification: string; alreadyFiltered: string; }; didYouMean: { suggestionBeforeOriginal: string; suggestionBeforeCorrected: string; suggestionAfterCorrected: string; correctionBeforeCorrected: string; correctionBeforeOriginal: string; correctionAfterOriginal: string; expansionBeforeOriginal: string; expansionBeforeCorrected: string; expansionAfterCorrected: string; }; pageSizeSelector: { pageSizeChoice: string; defaultPageSize: string; defaultPageSizeChoice: string; }; pager: { pageNumberTitle: string; firstPage: string; nextPage: string; previousPage: string; lastPage: string; }; sortSelector: { sortByTitle: string; sortOther: string; }; sort: { relevance: string; date: string; filename: string; title: string; }; queryIntent: { externalServiceTimeoutError: string; }; scopes: { allScopes: string; }; }; export { BsDidYouMean, BsLoadMore, BsLoadingBar, BsPageSizeSelector, BsPager, BsScopeComponent, BsScroller, BsSearchModule, BsSortSelector, BsTabs, FIRST_PAGE_OPTIONS, FirstPageService, SEARCH_OPTIONS, SearchService, _default as deSearch, _default$2 as enSearch, _default$1 as frSearch }; export type { FirstPageOptions, FloatStyle, SearchOptions };