Understanding context in Search
In Sitecore Search, context refers to a dynamic set of attributes and conditions that determine how search results are generated and presented. Context enables Search to deliver relevant content by tailoring search results based on user behavior, location, device, and other environmental factors.
You can configure results using context, preview a page in context, or use context to configure widget variation rules, such as boost, bury, and blacklist.
There are two types of context in Search:
-
Visitor context – attributes sent with a search request such as the type of device a visitor uses, the page viewed, and the geographical location. These values are sent in the Context object.
-
Site context – conditions you define in widget rules that determine when and how content is displayed.
The following table lists the contexts available for configuration in Search:
|
Context name |
Expected values |
Enabled by default | |
|---|---|---|---|
|
Content Type |
A system attribute indicating the type of content. |
"Article", "video", "pdf", and so on. |
|
|
Filter Applied |
Indicates whether any filters were applied in the search request payload. |
True or false. |
|
|
Id |
A system attribute representing the unique identifier of the content item. |
String or GUID. For example, "12345". |
|
|
Keywords |
The user's search input, equivalent to widget.items.search.query.keyphrase. |
Any string. For example, "Sitecore". |
|
|
Locale |
The language/region setting based on domain configuration. |
Locale codes. For example, "en-US", "fr-FR". |
|
|
Pages |
Indicates the specific page(s) in Searchwhere the widget is published. |
Page names or IDs. For example, "homepage". |
|
|
Review Rating |
A system attribute showing the rating score of a content item. |
Numeric. For example, 1, 3.5, 5. |
|
|
Custom Attributes |
Any additional attributes marked as Available for site context during configuration. |
Varies. For example, "author", "region". |
(Configurable) |