11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The EnumField type allows defining a field whose values are a closed set, and the sort order is pre-determined<br />

but is not alphabetic nor numeric. Examples of this are severity lists, or risk definitions.<br />

Defining an EnumField in schema.xml<br />

The EnumField type definition is quite simple, as in this example defining field types for "priorityLevel" and<br />

"riskLevel" enumerations:<br />

<br />

<br />

Besides the name and the class, which are common to all field types, this type also takes two additional<br />

parameters:<br />

enumsConfig: the name of a configuration file that contains the list of field values and their<br />

order that you wish to use with this field type. If a path to the file is not defined specified, the file should be<br />

in the conf directory for the collection.<br />

enumName: the name of the specific enumeration in the enumsConfig file to use for this type.<br />

Defining the EnumField configuration file<br />

The file named with the enumsConfig parameter can contain multiple enumeration value lists with different<br />

names if there are multiple uses for enumerations in your <strong>Solr</strong> schema.<br />

In this example, there are two value lists defined. Each list is between enum opening and closing tags:<br />

<br />

<br />

<br />

Not Available<br />

Low<br />

Medium<br />

High<br />

Urgent<br />

<br />

<br />

Unknown<br />

Very Low<br />

Low<br />

Medium<br />

High<br />

Critical<br />

<br />

<br />

Changing Values<br />

You cannot change the order, or remove, existing values in an<br />

You can however add new values to the end.<br />

without reindexing.<br />

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

60

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

Saved successfully!

Ooh no, something went wrong!