/ factorpad.com / tech / solr / reference / solr-field-types.html
An ad-free and cookie-free website.
Beginner
The following information is provided for those evaluating Apache Solr for website search or enterprise search applications. Solr uses Lucene libraries for custom search much as Elasticsearch does.
Solr schema refers to a configuration file that instructs Solr how to index documents. Documents may contain structured data like you might find in a database like an online store, or unstructured data as used in full text search applications like search engines.
The Solr schema is formatted in the file called
managed-schema
when the user elects to
make modifications using the Solr Schema API, or
schema.xml
for more advanced users
who modify the schema by hand.
Fields in Solr are custom to the documents themselves and the information being searched for. Each Field is assigned a Field Type which provides rules for how Fields of that type should be processed.
An example for both Field Types and Fields might look like this (including the XML and schema tags).
The schema file is typically hundreds of lines long, and above is a snippet first of a simple Field Type that processes Fields that are given the type="text_general" name. In this case, the title Field pulled from the indexed document is assigned this Field Type.
Where you see class="solr.TextField", this is where Solr points to a class of code that processes Fields of that type, in this case text. There are 21 such classes provided by Solr version 7 listed below.
Below is a list of 21 Field Type classes provided by Solr 7 that are not
soon to be deprecated. The full path to point to the class is
org.apache.solr.schema.<fieldType>
but this can be abbreviated simply with
solr.<fieldType>
.
fieldType | Description |
---|---|
BinaryField |
For binary data. |
BoolField |
For true or false data. |
CollationField |
For multiple language processing with Unicode symbols. |
CurrencyFieldType |
For currencies and exchange rate data. |
DateRangeField |
For date range calculations. |
DatePointField |
For date Fields at a point in time. |
DoublePointField |
For 64-bit floating point data. |
ExternalFileField |
For data located in an external file. |
EnumFieldType |
For ordering data using a scheme other than alphabetic or numeric sorting. |
FloatPointField |
For 32-bit floating point data. |
ICUCollationField |
For Unicode Field specifications. |
IntPointField |
For 32-bit signed integers. |
LatLonPointSpatialField |
For geospatial data, this holds latitudes and longitudes. |
LongPointField |
For 64-bit signed integers. |
PointType |
For sorting geospatial data. |
PreAnalyzedField |
For passing tokens that have already been analyzed. |
RandomSortField |
For returning search results in random order. |
RPT |
For geospatial data coordinates. The long form is SpatialRecursivePrefixTreeFieldType. |
StrField |
For short strings encoded with UTF-8 Unicode and are not analyzed or tokenized. |
TextField |
For text that includes multiple words to be broken into tokens. |
UUIDField |
For a Universally Unique Identifier (UUID) Field. |
The following is an example of a Field Type definition for binary Fields.
The following is an example of a Field Type definition for boolean Fields.
The following is an example of a Field Type definition for text Fields with a one-line analyzer class. It is more common to have multi-line analyzer classes for text Fields.
The following is an example of a Field Type definition for string Fields.
FactorPad offers Apache Solr Search content in both tutorials and reference.
See what other free learning is available at our YouTube Channel. Follow @factorpad on Twitter for updates, or good old fashioned email below.
/ factorpad.com / tech / solr / reference / solr-field-types.html
A newly-updated free resource. Connect and refer a friend today.