complete(environment, password, field, input) : suggestions
The complete method receives a field name and input string and returns a list of suggested Completions. This service is used to give a user instant feedback while he is typing his query. If the given field is the FULLTEXT field, the service returns suggestions from all configured dictionaries that are not explicitly excluded from full-text suggestions.
If a translation table is configured as a knowledge resource for the requested field, it is possible this way to retrieve suggestions for specific languages. Auto complete service uses the following order to decide which languages to use:
- if user is present:
- User's language preference as stored in UserSettings
- Environment's default languages as configured
- optional language parameter in the request
- English as fallback
- else: optional language parameter in the request or English as fallback
Field label are translated by using the first language in the optional language parameter or English as fallback
Another optional parameter is the searchEngine. If present, only suggestions for fields that are applicable to that searcher are returned.
|environment||string||identifier of a search environment|
|password||string||password for the search environment|
|field||string||name of the field to retrieve completions for or FULLTEXT for suggestions from multiple dictionaries|
|language||string||optional comma separated 2-letter ISO-639-1 language codes. The first language is used for field label translations. All languages are used to retrieve completions when the request doesn't contain a user or the user doesn't have language preferences and the environment doesn't have default languages set.|
|user||string||optional the unique identifier of the user in the integrating application. Languages saved in UserSettings will be used if exists|
|input||string||user-typed input string.|
|searchEngine||string||optional identifier of a searcher.
If not null, is used to confine the suggestions to that searcher's applicable fields.
|suggestions||list of Completion||List of objects containing the suggested item and its field name and label.|
|EMPTY_ARGUMENT||One or more mandatory arguments are empty.|
|INVALID_PASSWORD||The password is incorrect.|
|ENVIRONMENT_NOT_AVAILABLE||The environment is not available (see log-file for possible errors).|
|NOT_ENOUGH_CHARACTERS||The input string is empty.|
|NO_DICTIONARY_FOR_FIELD||There requested field has no dictionaries configured.|
|FIELD_NOT_APPLICABLE||The requested field is not applicable for the given searcher.|
|SEARCHER_NOT_FOUND||A searcher for the provided searchEngine name was not found in the provided environment.|
completeWithToken(accessToken, field, input) : suggestions
The same method as complete but with token authentication.
The method can raise the same errors as the corresponding complete method, but can return an INVALID_ACCESS_TOKEN error instead of the INVALID_PASSWORD error.
|INVALID_ACCESS_TOKEN||The token is not valid (possibly timed-out).|