UNPKG

search-client

Version:

Javascript library for executing searches in the Haive search-index via the SearchManager REST interface.

29 lines (28 loc) 1.71 kB
import { AuthToken } from '../Authentication'; import { BaseCall, Fetch, IQuery } from '../Common'; import { IAutocompleteSettings } from './AutocompleteSettings'; /** * This class allows you to create a service that executes autocomplete lookups for the Haive SearchManager service. * * Note: Typically you will not instantiate this class. Instead you will use it indirectly via the SearchClient class. */ export declare class Autocomplete extends BaseCall<string[]> { settings: IAutocompleteSettings; private queryConverter; /** * Creates an Autocomplete instance that knows how to get query-suggestions. * @param settings - The settings for how the Autocomplete is to operate. * @param auth - The object that handles authentication. */ constructor(settings: IAutocompleteSettings | string, auth?: AuthToken, fetchMethod?: Fetch); maxSuggestionsChanged(oldValue: number, query: IQuery): void; queryTextChanged(oldValue: string, query: IQuery): void; /** * When called it will execute a rest-call to the base-url and fetch autocomplete suggestions based on the query passed. * Note that if a request callback has been setup then if it returns false the request is skipped. * @param query - Is used to find out which autocomplete suggestions and from what sources they should be retrieved. * @param suppressCallbacks - Set to true if you have defined callbacks, but somehow don't want them to be called. * @returns a Promise that when resolved returns a string array of suggestions (or undefined if a callback stops the request). */ protected fetchInternal(query?: IQuery, suppressCallbacks?: boolean): Promise<string[]>; }