SXA search facets, scopes, and tokens

Current version: 10.3

To enable visitors to quickly find what they are looking for, SXA comes with flexible out-of-the-box search functionality.

When visitors search a site and it returns too many results, they can quickly refine the search by filtering.

You can create a search solution by adding different search renderings to your page. For example, a search box, different filters for refining the search, and the search results. Because SXA uses events to communicate between renderings, when you change a filter for the search, automatically all of the renderings are informed and the search triggers the new search request.

All the filter parameters and values, such as current page, location, and sort order, are stored in the browser URL after the hash sign. For example, a search on a site that lists tropical fruits, with search filters for size and color might look like this:

Search that includes filters.
Note

SXA supports Solr and Azure search. The search engines are used for searching in the content databases, as well as for searching in a number of operational databases that Sitecore uses for collecting analytics data, test data, and so on.

Make sure to enable the search configuration file depending on the Sitecore environment configuration: Website\App_Config\Include\z.Foundation.Overrides

SXA comes with several standard search renderings. You can combine these renderings for a search solution that suits your site. All rendering items have two types of configurations: data source items that are used to store rendering texts (to allow for translations) and other rendering properties, such as target signatures, scopes, and facets.

Note

Developers can create other search renderings.

Facets

A facet is a way of refining search results by categorizing the items returned by the search. For example, for a blog search page, all blogs contain fields such as: author, date, and language. Based on these fields, you can create facets to allow visitors to use them as filters.

You can add facets to your site in: sitecore/content/Tenant/Site/Settings/Facets/

Note

The Sitecore platform facets are stored in /sitecore/system/Settings/Buckets/Facets

The facet types are: Bool Facet, Date Facet, Distance Facet, Float Facet, Integer Facet, and List Facet.

Add facets to your site.

Not all facets apply to all renderings. For example, the Filter (Dropdown) rendering cannot use the Date Facet because it only applies to the Filter (Date) rendering.

The following table lists which facets the components can use.

Facet

Component

Date

Filter (Date)

Distance

Filter (Radius), Location Finder

Float

Filter (Managed Range), Filter (Range Slider), Filter (Slider)

Integer

Filter (Managed Range), Filter (Range Slider), Filter (Slider)

List

Filter (Checklist), Filter (Dropdown)

Scopes

Search scopes can be used to limit search results based on conditions. Search scopes are stored in: /sitecore/content/Tenant/Site/Settings/Scopes/

For a new scope, you build a search query that enables you to add several conditions. For example, for a search scope for weekend trips on a travel site, you can combine the location of the trips with the template.

Add a scope
Note

By default, search results are limited to the scope of the current site, but you can include other sites in the search scope.

Tokens

SXA comes with predefined tokens that you can use in search queries to apply additional search filters. To use one of the predefined SXA tokens, in the Build Search Query dialog box, in the search field, enter SXA and click Enter to see the available search tokens.

Do you have some feedback for us?

If you have suggestions for improving this article,