Skip to main content

Autocomplete Service

Overview

The Autocomplete Service provides methods to retrieve autocomplete items for a given text.

getFromSuggestQueriesForText

Retrieves autocomplete items for the given text, max count for each category handled by the service can be specified in the admin.

Parameters

ParameterTypeDescription
textstringText to retrieve autocomplete items for

Returns

Observable<Suggestion[][]>: An observable of an array of Suggestion arrays grouped by suggestion queries configured in the admin.

Example

autocompleteService.getFromSuggestQueriesForText('example text').subscribe(suggestions => {
console.log(suggestions);
});

getFromUserSettingsForText

Retrieves autocomplete items for the given text from the user settings.

Parameters

ParameterTypeDescription
textstringText to retrieve autocomplete items for
maxCountnumber | AutocompleteMaximum number of items to retrieve

Returns

Suggestion[]: An array of Suggestion arrays grouped by recent-searches, saved-searches, bookmarks from the user settings.

Example

const suggestions = autocompleteService.getFromUserSettingsForText('example text', 5);
console.log(suggestions);