11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Managed Schema Default<br />

When a is not explicitly declared in a solrconfig.xml file, <strong>Solr</strong> implicitly uses a Manage<br />

dIndexSchemaFactory , which is by default "mutable" and keeps schema information in a managed-schem<br />

a file.<br />

<br />

<br />

true<br />

managed-schema<br />

<br />

If you wish to explicitly configure ManagedIndexSchemaFactory the following options are available:<br />

mutable - controls whether changes may be made to the Schema data. This must be set to true to allow<br />

edits to be made with the Schema API.<br />

managedSchemaResourceName is an optional parameter that defaults to "managed-schema", and<br />

defines a new name for the schema file that can be anything other than " schema.xml".<br />

With the default configuration shown above, you can use the Schema API to modify the schema as much as you<br />

want, and then later change the value of mutable to false if you wish to "lock" the schema in place and prevent<br />

future changes.<br />

Classic schema.xml<br />

An alternative to using a managed schema is to explicitly configure a ClassicIndexSchemaFactory.<br />

Class<br />

icIndexSchemaFactory requires the use of a schema.xml configuration file, and disallows any programatic<br />

changes to the Schema at run time. The schema.xml file must be edited manually and is only loaded only<br />

when the collection is loaded.<br />

<br />

Switching from schema.xml to Managed Schema<br />

If you have an existing <strong>Solr</strong> collection that uses ClassicIndexSchemaFactory, and you wish to convert to<br />

use a managed schema, you can simplify modify the solrconfig.xml to specify the use of the ManagedInde<br />

xSchemaFactory. Once <strong>Solr</strong> is restarted and it detects that a schema.xml file exists, but the managedSchem<br />

aResourceName file (ie: " managed-schema") does not exist, the existing schema.xml file will be renamed to s<br />

chema.xml.bak and the contents are re-written to the managed schema file. If you look at the resulting file,<br />

you'll see this at the top of the page:<br />

<br />

You are now free to use the Schema API as much as you want to make changes, and remove the schema.xml<br />

.bak.<br />

Changing to Manually Edited schema.xml<br />

If you have started <strong>Solr</strong> with managed schema enabled and you would like to switch to manually editing a sche<br />

ma.xml file, you should take the following steps:<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

439

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!