autocomplete-suggest
Returns autocomplete suggestions for a given input string. The SOAP name of this function is: AutocompleteSuggest
Synopsis
suggestions nodeset autocomplete-suggest(dictionary, str, num, rights, filter, bag-of-words);
string dictionary;
string str;
int num;
string rights;
string filter;
boolean bag-of-words;Parameters
- string dictionary - The name of the dictionary that created the autocomplete datastore. (Required)
- string str - The input string to autocomplete. (Required)
- int num - The number of suggestions to return. Default value: 10.
- string rights - A newline separated list of rights that the suggestions should respect.
- string filter - The node that contains the filters that should be applied on the suggestions returned.
- boolean bag-of-words - If this setting is enabled, solutions match even if the terms are out of order. Default value: false.
Return Value
- suggestions nodeset
Exceptions
- There are no exceptions specific to this function.
Authentication
Like all Watson Explorer Engine API functions except for ping, the autocomplete-suggest function requires authentication.
When using REST, you can simply pass v.username and v.password as CGI parameters via HTTP or HTTPS to authenticate the REST call to the autocomplete-suggest function.
When using the SOAP API, you can pass credentials as parameters on an endpoint, or you can leverage the authentication method that is supported by all Watson Explorer Engine functions. Each provides a setAuthentication method that can be passed an authentication object to provide the user name and password under which a function runs. An example of this in Java for a SOAP call to the autocomplete-suggest function is the following:
Authentication authentication = new Authentication();
authentication.setUsername("joe-user");
authentication.setPassword("joes-password");
AutocompleteSuggest foo = new AutocompleteSuggest();
foo.setAuthentication(authentication);
A single authentication object would typically be reused throughout each individual application.