Configure SXA indexing
SXA lets you define indexes per specific language, or site. This can be convenient when you want to separate data to keep the index small and increase performance.
Add an index
To add an index:
-
Navigate to /sitecore/content/Tenant/Site/Settings/Site Grouping/Site.
-
In the Indexing section, you can enter your index specifications for the site. Always start with the database followed by a slash. You can then specify the language or use an * to include all languages.
For example, you can create site specific indexes or you can separate between the English and Spanish language:
NoteIf you want to configure an SXA search index to include items of a single specific language, you must add a language parameter for the crawler:
RequestResponse<locations hint="list:AddCrawler"> <crawler type="Sitecore.XA.Foundation.Search.Crawlers.SxaItemCrawler, Sitecore.XA.Foundation.Search"> <Database>master</Database> <Root>/sitecore</Root> <Language>en</Language> </crawler> </locations>
-
Go to your search provider config file to add the indexes you created. For example, if you use Solr, go to:
C:\inetpub\wwwroot\Site\Website\App_Config\Include\Z.Foundation.Overrides\Sitecore.XA.Foundation.Search.Solr
and add your index.
The default crawler path is <Root>/sitecore</Root>
. When you configure the item crawler paths in your custom indexes to use a different path than the default path (for example: <Root>/sitecore/content/TenantA/SiteA/Home/NewFolder</Root>
), this has the following impact:
-
Only items from that path are indexed.
-
Your custom index will not contain templates.
Missing templates in the index might impact the field types resolving logic. In some cases, the field type might not be found and this can generate issues while searching or filtering results. To resolve this, you must manually define all custom fields in the configuration files so that Sitecore knows what types they use (string, integer, text, and so on).

For general information on Sitecore indexing, please refer to the Platform documentation.
Configure a custom index
SXA-specific fields are not automatically included in all indexes. If you want to use a custom index and still use SXA search features, you must configure your custom index to include the SXA-specific fields.
To add SXA-specific fields to your index:
-
In your index configuration, locate the
index
node that defines your custom index. -
Inside the
documentOptions
node, add the following code:RequestResponse<fields hint="raw:AddComputedIndexField"> <field fieldName="site"> <patch:delete /></field> <field fieldName="site" returnType="stringCollection">Sitecore.XA.Foundation.Search.ComputedFields.Site, Sitecore.XA.Foundation.Search</field> <field fieldName="sxacontent" returnType="textCollection" type="Sitecore.XA.Foundation.Search.ComputedFields.AggregatedContent, Sitecore.XA.Foundation.Search"> <mediaIndexing ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/mediaIndexing"/> </field> <field fieldName="haslayout" returnType="bool">Sitecore.XA.Foundation.Search.ComputedFields.HasLayout, Sitecore.XA.Foundation.Search</field> <field fieldName="searchable">Sitecore.XA.Foundation.Search.ComputedFields.Searchable, Sitecore.XA.Foundation.Search</field> <field fieldName="parentname" returnType="string">Sitecore.XA.Foundation.Search.ComputedFields.ParentName, Sitecore.XA.Foundation.Search</field> <field fieldName="level" returnType="int">Sitecore.XA.Foundation.Search.ComputedFields.Level, Sitecore.XA.Foundation.Search</field> <field fieldName="parenttemplate" returnType="string">Sitecore.XA.Foundation.Search.ComputedFields.ParentTemplate, Sitecore.XA.Foundation.Search</field> <field fieldName="inheritance" returnType="stringCollection" type="Sitecore.XA.Foundation.Search.ComputedFields.Inheritance, Sitecore.XA.Foundation.Search"/> </fields>
-
Save the changes and rebuild your index.