Ideas for search experiences
This topic describes examples of search experiences you can build using the Cloud SDK search package.
This is not a comprehensive list of what you can build, and your implementation might differ depending on your application requirements and your website content that Sitecore Search indexed.
Search results page
Here's an example search results page built using the Cloud SDK:

Configuring your request
When you build your own search results page, use SearchWidgetItem to configure your request and getWidgetData to make the request. You'll most often use the following to configure your request:
-
content- to select which attributes to return for each index document. Settingcontentto an empty object ensures that all attributes are returned. -
limit- to limit the number of index documents to return. Used for pagination. -
offset- to skip the first N number of potential index documents to return. Used for pagination. -
facet- to create faceted search. -
query.keyphrase- the text the site visitor enters in the search field to perform a search, such as"athletic sneakers". Capture this value using the tools of your web app's library or framework, for example, using React state and events. -
sort- to apply sorting logic to the search results. For example, to enable site visitors to sort search results by their title. -
filter- to exclude all index documents that don't match specific criteria, before they are returned to your app. For example, to exclude all index documents where theout_of_stockattribute istrue. -
context- to return personalized results using details such as the site visitor's locale, location, device, and web browser information. -
sources- to return index documents only from the sources you choose. If you don't specify this attribute, index documents from all sources will be returned.
Example request
To better understand the following code example, we recommend that you complete the Create a search results page walkthrough.
Here's an example script to request search content:
Example response
Here's an example response:
In the response:
-
widgets.facetcontains the requested facets. -
widgets.contentcontains the index documents that match the request. -
widgets.sortcontains the sorting logic for sorting the index documents.
Recommendations
Recommendation widgets are suitable to display trending content, recently viewed content, or personalized recommendations.
Here's an example recommendation widget built using the Cloud SDK:

Configuring your request
When you build this type of search experience, use RecommendationWidgetItem to configure your request and getWidgetData to make the request. You'll most often use the following to configure your request:
-
content- to select which attributes to return for each index document. Settingcontentto an empty object ensures that all attributes are returned. -
limit- to limit the number of index documents to return. Used for pagination. -
filter- to exclude all index documents that don't match specific criteria, before they are returned to your app. For example, to exclude all index documents where theout_of_stockattribute istrue. -
context- to return personalized results using details such as the site visitor's locale, location, device, and web browser information.
Example request
Here's an example script to request recommendation content:
Example response
Here's an example response:
In the response, widgets.content contains the index documents that match the request.
Search preview and suggestions
Here's an example search preview and suggestions widget. It lets you present site visitors with suggestions that update as they enter text in the search field:

Configuring your request
When you build this type of search experience, use SearchWidgetItem to configure your request and getWidgetData to make the request. You'll most often use the following to configure your request:
-
content- to select which attributes to return for each index document. Settingcontentto an empty object ensures that all attributes are returned. -
limit- to limit the number of index documents to return. Used for pagination. -
query.keyphrase- the text the site visitor enters in the search field to perform a search, such as"athletic sneakers". Capture this value using the tools of your web app's library or framework, for example, using React state and events. -
suggestion- to show suggested index documents to site visitors as they enter text in the search field. -
context- to return personalized results using details such as the site visitor's locale, location, device, and web browser information.
Example request
Here's an example script to request search preview and suggestion content:
Example response
Here's an example response:
Questions and answers
If the Questions & Answers capability is configured in your instance of Sitecore Search and batch generation runs at least once, you can use the questions-answers widget that displays the site visitor's question, an AI-generated answer and, optionally, related questions. Here's an example widget:

Configuring your request
When you build such a search experience, use QuestionsAnswersWidgetItem to configure your request and getWidgetData to make the request. You'll most often use the following to configure your request:
-
keyphrase- the text the site visitor enters in the search field to perform a search, such as"what is sitecoreai". Capture this value using the tools of your web app's library or framework, for example, using React state and events.NoteSitecore Search returns
exactAnswerandrelatedQuestionsonly if thekeyphrasequalifies as a question or statement. If instead thekeyphrasequalifies as a keyword, the questions-answers widget returns empty.To ensure that the site visitor receives results regardless of the
keyphrasetype, we recommend that you request data for multiple widgets in a single request. For example, request data for bothrfkid_7andrfkid_qa. This way, if thekeyphraseis a question or statement, the result is returned inrfkid_qa. If thekeyphraseis a keyword, the result is returned inrfkid_7. -
relatedQuestions- AI-generated question-and-answer pairs relevant to the site visitor's query.
Example request
To better understand the following code example, we recommend that you complete the Create a questions-answers widget walkthrough.
Here's an example script to request questions and answers content:
Some code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.
Example response
Here's an example response:
In the response:
-
widgets.answer.questioncontains the site visitor's original question. -
widgets.answer.answercontains the AI-generated answer. -
widgets.related_questionscontains questions related to the site visitor's original question.
Q&A responses are generated from content across your entire index. A single answer may combine information from multiple documents and sources. Filtering Q&A responses by source or site is not currently supported.