Use the Suggest Via the Search API

If you are using a custom UI, you probably want to access the suggest backend API, which directly provides the suggestion.

See Also
Create a Suggest Dictionary
Enable the Suggest in the Mashup UI
Export Suggest Dictionary Content to an XML File

It is available as a Search API command, by default on /suggest.

For example, if the name of your suggest is "mysuggest", then the API is available on:

http://<searchserver_host>:<searchAPI_port>/suggest/service/mysuggest

It supports HTTP GET queries, with the following input parameters.

Parameter

Value

Description

q

string

The input query

distance

integer

(0, 1, 2)

The suggest dictionaries supports fuzzy matching at runtime. This specifies the maximum Levenshtein distance between the input string and the suggestion. 0 means exact match

minLenForDist1

integer

Only searches for distance 1 fuzzy matches if the original word in the query is at least N characters long. This avoids too much approximation on very short words. The suggested value is 3.

minLenForDist2

integer

Only searches for distance 2 fuzzy matches if the original word in the query is at least N characters long. This avoids too much > approximation on very short words. The suggested value is 6.

logic

string

Specify a Search Logic name.

exhaustive

true/false Boolean

Displays exhaustive results.

recurse

true/false Boolean

Suggests new matches on query words recursively.

autocomplete

true/false Boolean

Suggests matches for the last word only.

output

string

(xml or json)

Output format:

  • xml – returns a complete output, with text suggestions, score, distance.
  • json – returns text suggestions only.

Other search output format such as csv, flea, and atom, are not supported.

Note: The Accept HTTP header is also taken into account if output is not specified.

callback

string

When using JSON output, the name of a Javascript function to call. The returned Javascript fragment is "callback && callback(json_object)".