Solr managed schemas

Last updated Friday, April 6, 2018 in Sitecore Experience Platform for

Note

This topic is valid for Sitecore 9.0 and later.

Solr has a RESTful API that you use to manage schemas programmatically. The cores and collections reload automatically after you update the schema.

Solr sample configuration sets use managed schemas instead of the legacy manual schema (schema.xml file). You can still use the manual schema by setting the <schemaFactory> class to ClassicIndexSchemaFactory in the solrconfig.xml file.

Sitecore supports managed schemas, and has a tool that you use to populate the schema using the Schema API directly to Solr.

To prepare the config sets and the managed schema:

  1. Copy the Solr provided configuration example from the configsets folder into [SOLR_DIR]/server/solr and rename it to the appropriate index name.
  2. Open the managed schema file in the conf subfolder of the folder created in step 1.
    1. Set the value in <uniqueKey>id</uniqueKey> to _uniqueid.
    2. In the fields section, add the following field configuration for _uniqueid:

      <field name="_uniqueid" type="string" indexed="true" required="true" stored="true"/>

    3. Save your changes.
  3. Repeat step 1 and step 2 for all indexes.

To populate the schema from the Control Panel:

  1. Start Solr.
  2. Start Sitecore, and go to the Control Panel.
  3. In the Indexing tab, click Populate Solr Managed Schema:

    y

  4. In the Schema Populate window, select the indexes you want to populate:

    b

  5. Click Populate.

Populate schema from admin page

You can also populate schemas from the admin page. This is especially useful if you populate schemas from PowerShell scripts.

To do so:

  1. Call http://YOUR_INSTANCE/sitecore/admin/ PopulateManagedSchema.aspx?indexes=sitecore_master_index|sitecore_core_index|sitecore_web_index. You use the indexes query parameter to pass the names of the indexes that you want to populate as a pipe (‘|’) separated list.
  2. Inspect the HTTP status code to verify the result (200 means success).

Send feedback about the documentation to docsite@sitecore.net.