schema.xml is usually the first file you configure when setting up a new Solr installation.
The schema declares:
The XML consists of a number of parts. We'll look at these in turn:
<types> <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> ... </types>
The example Solr schema.xml comes with a number of pre-defined field types, and they're quite well-documented. You can also use them as templates for creating new field types.
The commonly used ones are:
A generically useful text field. Its described in the documentation as:
A text field that uses WordDelimiterFilter to enable splitting and matching of words on case-change, alpha numeric boundaries, and non-alphanumeric chars, so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi". Synonyms and stopwords are customized by external files, and stemming is enabled.
Useful when you have a text field which you don't want tokenized, like IDs. Its described in the documentation as:
The StrField type is not analyzed, but indexed/stored verbatim. - StrField and TextField support an optional compressThreshold which limits compression (if enabled in the derived fields) to values which exceed a certain size (in characters).
Useful for dates. Its described in the documentation as:
The format for this date field is of the form 1995-12-31T23:59:59Z, and is a more restricted form of the canonical representation of dateTime http://www.w3.org/TR/xmlschema-2/#dateTime
You can find a list of Java classes which implement FieldType here.
The Solr Wiki also has some information on field types.
<fields> <field name="id" type="string" indexed="true" stored="true" required="true" /> <field name="name" type="textgen" indexed="true" stored="true"/> ... </fields>
The documentation provides a list of valid attributes:
The Solr Wiki has more information on fields like dynamic fields etc.
Equivalent to the primary key of the document.
Field to use to determine and enforce document uniqueness. Unless this field is marked with required="false", it will be a required field