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.contentlists the blocks shown before the searcher types: their ownsearchHistory, and thepopularQueriesandpopularResultsof other searchers. Popular entries come from real searches, so they appear once your search has traffic.suggestions.source.queryBased.contentlists the blocks shown while the searcher types. AresultGroupblock shows the best-matching results.- Each entry in
dataPointsnames a data point by itskey.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"}]}]}}}}