Broadly schema.xml
contains following information:
Different types of field names of schema and data types (
<fields>…<field>
)Definition of user/seeded defined data types (
<types>…<fieldTypes>
)Dynamic fields (
<fields>….<dynamicField>
)Information about
uniqueKey
to define each document uniquely (<uniqueKey>
)Information regarding
QueryParser
for Solr (<solrQueryParser>
)Default search field is used when the user does not pass the field name (
<defaultSearchField>
)Information about copying a field from one to another (
<copyField>
)
In Chapter 2, Understanding Solr, we have already explained important attributes of the schema.xml
file. Here is a sample schema.xml
file in which the fields will look like the following screenshot:
Remove all the copy fields, if not needed. The uniqueKey
field is used to determine each document uniquely and will be required unless it is marked as required=false
. The default search field provides a field name that Solr will use for searching when the user does not specify any field. Specify unique key and default search as shown in the following screenshot: