Integrating Suggest via JSON

As in the previous example, the JSON interface is accessed via calling suggest.ff. You need to supply the parameter format=json to receive output in a JSON format. If you want the response to be formatted as JSONP output, the parameter format=jsonp must be passed, and the calling method must be passed in the callback parameter.

$stringEscapeUtils.escapeHtml($body)

You can find the schema definition of the output under:

$stringEscapeUtils.escapeHtml($body)

The output contains several objects, each representing a suggestion. The suggestion text is the value of name; the number of expected hits is given by hitCount. If this value is 0 then no number has been calculated or derived from the log files. imageUrl contains a link to the preview image when this feature has been enabled. The suggestion type is given by type. The searchParams attribute contains the FACT-Finder URL that should be called when the corresponding suggestion is selected. If a suggestion has additional attributes, these are listed as name/value pairs under Attributes.

{
    "suggestions":[
      {
        "attributes": {},
        "hitCount": 1281,
        "image": "",
        "name": "helmet",
        "searchParams": "...searchParams url...",
        "type": "searchTerm"
      },
      {
        "attributes": {
          "sourceField": "category3"
        },
        "hitCount": 0,
        "image": "/media/mountainbike_helmet.jpg",
        "name": "Mountain bike helmets",
        "searchParams": "...searchParams url...",
        "type": "category"
      },
      ...
    ]
}