Skip to main content

Search Suggestions

This Site Search 360 demo shows two kinds of search suggestions. Click into the search box to see suggestions before you type, then type granola or chicken to see matching recipes with their cost and prep time. View the ss360Config to check the configuration.

  • suggestions.source.emptyState.content lists the blocks shown before the searcher types: their own searchHistory, and the popularQueries and popularResults of other searchers. Popular entries come from real searches, so they appear once your search has traffic.
  • suggestions.source.queryBased.content lists the blocks shown while the searcher types. A resultGroup block shows the best-matching results.
  • Each entry in dataPoints names a data point by its key. type: 'value' shows it as text, type: 'chip' as a badge.

In Design & Publish: Settings → Suggestions → Empty State and Query-based, then Customize. See Design & Publish for the block types.

window.ss360Config = {
siteId: '83460', /* Replace with your site id */
searchBox: {
selector: '#searchBox' /* Replace with the css selector of your search box */
},
suggestions: {
source: {
emptyState: {
layoutType: 1,
content: [
{
type: 'searchHistory'
},
{
type: 'popularQueries'
},
{
type: 'popularResults'
}
]
},
queryBased: {
layoutType: 1,
content: [
{
type: 'resultGroup',
dataPoints: [
{
key: 'Cost',
type: 'value'
},
{
key: 'Prep Time',
type: 'chip'
}
]
}
]
}
}
}
};
{"siteId":"83460","searchBox":{"selector":"#searchBox"},"suggestions":{"source":{"emptyState":{"layoutType":1,"content":[{"type":"searchHistory"},{"type":"popularQueries"},{"type":"popularResults"}]},"queryBased":{"layoutType":1,"content":[{"type":"resultGroup","dataPoints":[{"key":"Cost","type":"value"},{"key":"Prep Time","type":"chip"}]}]}}}}