The suggestion request object
You can add a suggestion JSON object in a Sitecore Discover Search and Recommendation request. The suggestion object contains the different types of suggestions you can use to autocomplete your query and display predictive search results. Each <suggestion_type> provides a specific algorithm to generate suggestions.
The following shows the structure of the suggestion object in a request:
Keys
The following table describes the keys that theĀ suggestion object contains.
| Key | Type/default value | Description | Value |
|---|---|---|---|
| suggestion_type> | Suggestion type object | Required.Contains the specific algorithm for generating suggestions. | autocomplete (Default)keyphrasecategorytrending_categoryrecent |
Suggestion type object
The following table describes the keys in the suggestion type object:
| Key | Type | Description |
|---|---|---|
| max | integer | Optional.The maximum number of suggestions.Default: 5. |
| in_content | array | Optional.Contains the specific <content_type> for the requested suggestion.NoteThere is no default value for in_content because there is no limitation on the <content_type> . |
Suggestion types
The following are different types or algorithms for generating the suggestion:
| Suggestion type | Description | Value |
|---|---|---|
| keyphrase | A mix of suggestions. | type_correctionquery_expansionrelated_search |
| category | Categories that contain the search term. | n/a |
| trending_category | A category that is trending now. | n/a |
| recent | Recent search history. | n/a |
Related key
The following table describes the key related to theĀ suggestion object.
| Key | Type | Description |
|---|---|---|
request_for | array | Optional. Contains the request parameters. You can request any field in the request data or request all fields using the wild card all. |
Example
The following shows an example of a request to get the user's last ten search queries in the product content type: