Update Solr schema and rebuild indexes

Version: 10.5
Note

This is required for upgrading from Sitecore XP 10.4.0 or earlier. If you are using Solr 9.8.1, you can skip the section 'Adapt your custom Solr schema'

After Sitecore XP 10.5.0 installation has finished, update your Solr schema to support Solr 10.0.0 and rebuild all indexes, as follows.

Adapt your custom Solr schema (if applicable):

If you are using a custom Solr schema, for example you modified the managed-schema or defined your own custom field types via a custom schema populate helper, then there are two important actions required for compatibility with Solr 10.0.0 and Sitecore 10.5.0:

  1. Update the base type for your custom schema populate helper. Your custom populate helper must be based on class Sitecore.ContentSearch.SolrProvider.Pipelines.PopulateSolrSchema.SolrV10SchemaPopulate instead of class Sitecore.ContentSearch.SolrProvider.Pipelines.PopulateSolrSchema.SchemaPopulateHelper.
  2. Revise the configuration of custom fields. In this Solr version, field types based on the solr.TextField class no longer support sorting. Consequently, to enable these operations multiple fields in Sitecore's Solr schema were switched to field types that are based instead on the solr.SortableTextField class. If you have defined custom fields based on the solr.TextField class and you require sorting or faceting operations, then you should switch these fields to use a field type based on the solr.SortableTextField class. For example:

    from
    <field name=”_name” type=”text_general” indexed=”true” stored=”true” />
    to
    <field name=”_name” type=”text_gen_sort” index=”true” stored=”true” />

    or from
    <field name=”_database” type=”lowercase” index=”true” stored=”true” />
    to
    <field name=”_database” type=”lowercase_sort” index=”true” stored=”true” />

Known issue:
After updating Solr to 10.0.0 or prior, pivot faceting on fields using the solr.SortableTextField field type may return incorrect, partial, or missing facet results. This issue is specific to pivot faceting and does not affect flat (single-level) facets. For more information see issue SOLR-16139

Note

If sorting or faceting is not needed, you can continue using the solr.TextField class.

Populate Solr schema for all indexes

Once Solr is running and Sitecore XP has been configured, populate the Solr schemas for all the indexes using the Schema Populate, available in the Control Panel. This step ensures that all necessary Sitecore fields are added to each Solr index schema.

Populate Solr schema for all indexes

After applying the schema changes and after registering your custom factory, rebuild all the indexes using the Indexing Manager, available in the Control Panel.

If you have suggestions for improving this article, let us know!