SXA search facets, scopes, and tokens

Abstract

SXA search uses events to communicate between all renderings.

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

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 Lucene, 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.

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)

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

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.