Solr field type reference for DSE Search

CQL data is parsed into DataStax Enterprise Search indexes using a corresponding Solr field type. The index schema for each table must contain the Solr field type definition along with optional advanced processing instructions.

See compatitbility matrix for CQL to Solr type mappings.

Trie field types

TrieDateField

Date field for Lucene TrieRange processing, supports indexing negative date. For example: -28011-12-02T00:00:00.002Z. To insert negative dates for the CQL timestamp, insert an epoch time in milliseconds. The TimestampType does not accept a textual representation of negative dates.

ALTER SEARCH INDEX SCHEMA ON <table_name>
ADD types.fieldType[@class='org.apache.solr.schema.TrieDateField', @name='TrieDateField'];

Results in the following schema XML:

<fieldType class="org.apache.solr.schema.TrieDateField" name="TrieDateField"/>
TrieDoubleField
ALTER SEARCH INDEX SCHEMA ON <table_name>
ADD types.fieldType[@class=org.apache.solr.schema.TrieDoubleField', @name='TrieDoubleField'];

Results in the following schema XML:

<fieldType class="org.apache.solr.schema.TrieDoubleField" name="TrieDoubleField"/>
TrieFloatField
ALTER SEARCH INDEX SCHEMA ON <table_name>
ADD types.fieldType[@class='org.apache.solr.schema.TrieFloatField', @name='TrieFloatField'];

Results in the following schema XML:

<fieldType class="org.apache.solr.schema.TrieFloatField" name="TrieFloatField"/>
TrieIntField
ALTER SEARCH INDEX SCHEMA ON <table_name>
ADD types.fieldType[@class='org.apache.solr.schema.TrieIntField', @name='TrieIntField'];

Results in the following schema XML:

<fieldType class="org.apache.solr.schema.TrieIntField" name="TrieIntField"/>
TrieLongField
ALTER SEARCH INDEX SCHEMA ON <table_name>
ADD types.fieldType[@class='org.apache.solr.schema.TrieLongField', @name='TrieLongField'];

Results in the following schema XML:

<fieldType class="org.apache.solr.schema.TrieLongField" name="TrieLongField"/>

String field types

AsciiStrField

Converts a CQL ascii into a standard Solr StrField.

ALTER SEARCH INDEX SCHEMA ON <table_name>
ADD types.fieldType[@class='com.datastax.bdp.search.solr.core.types.AsciiStrField', @name='AsciiStrField'];

Results in the following Schema XML:

<fieldType class="com.datastax.bdp.search.solr.core.types.AsciiStrField"
       name="AsciiStrField"/>
VarIntStrField

Define with the DataStax class to convert a CQL varint.

ALTER SEARCH INDEX SCHEMA ON <table_name>
ADD types.fieldType[@class='com.datastax.bdp.search.solr.core.types.VarIntStrField', @name='VarIntStrField'];

Results in the following schema XML:

<fieldType class="com.datastax.bdp.search.solr.core.types.VarIntStrField" name="VarIntStrField"/>
BinaryField
ALTER SEARCH INDEX SCHEMA ON <table_name>
ADD types.fieldType[@class='org.apache.solr.schema.BinaryField', @name='BinaryField'];

Results in the following Schema XML:

<fieldType class="org.apache.solr.schema.BinaryField" name="BinaryField"/>
BoolField

Due to SOLR-7264, setting docValues to true on a boolean field in the Solr schema does not work. A workaround for boolean docValues is to use 0 and 1 with a TrieIntField.

ALTER SEARCH INDEX SCHEMA ON <table_name>
ADD types.fieldType[@class='org.apache.solr.schema.BoolField', @name='BoolField'];

Results in the following Schema XML:

<fieldType class="org.apache.solr.schema.BoolField" name="BoolField"/>
SimpleDateField

Define with the DataStax class to convert a CQL date field into a compatible Solr date field.

ALTER SEARCH INDEX SCHEMA ON <table_name>
ADD types.fieldType[@class='com.datastax.bdp.search.solr.core.types.SimpleDateField', @name='SimpleDateField'];

Results in the following Schema XML:

<fieldType class="com.datastax.bdp.search.solr.core.types.SimpleDateField" name="SimpleDateField"/>
TextField
ALTER SEARCH INDEX SCHEMA ON <table_name>
ADD types.fieldType[@class='org.apache.solr.schema.TextField', @name='TextField'];

To perform searches containing wildcard characters like % in TextField data, do not use the Lucene StandardAnalyzer class. Instead, define the tokenizer and filters for use in a multiterm search.

UUIDField

UUIDField is a type 1 UUID data type, which includes the time of its generation. Values are sorted by conflict-free timestamps. For example, use the TimeUUID type to identify a column, such as a blog entry, by its timestamp and allow multiple clients to write to the same partition key simultaneously. To find data mapped from a TimeUUID to a UUIDField, search for the entire UUID value, not just its time component.

ALTER SEARCH INDEX SCHEMA ON <table_name>
ADD types.fieldType[@class='org.apache.solr.schema.UUIDField', @name='UUIDField'];

Results in the following Schema XML:

<fieldType class="org.apache.solr.schema.UUIDField" name="UUIDField"/>

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com