API for transforming Cassandra/Solr data

Use the field input/output transformer API to the input/output transformer support in OS Solr.

DSE Search/Solr includes the released version of a plugin API for Solr updates and a plugin to the CassandraDocumentReader. The plugin API transforms data from the secondary indexing API before data is submitted to Solr. The plugin to the CassandraDocumentReader transforms the results data from Cassandra to Solr.

Using the API, applications can tweak a Solr Document before it is mapped and indexed according to the schema.xml. The API is a counterpart to the input/output transformer support in OS Solr.

The field input transformer requires a trailing Z for date field values.

Procedure

To use the API:

  1. Define the plugin in the solrconfig.xml for a Cassandra table (Solr Core).
    <fieldInputTransformer name="dse" class="
      com.datastax.bdp.cassandra.index.solr.functional.
      BinaryFieldInputTransformer">
    </fieldInputTransformer>
    
    <fieldOutputTransformer name="dse" class="
      com.datastax.bdp.cassandra.index.solr.functional.
      BinaryFieldOutputTransformer">
    </fieldOutputTransformer>
  2. Write a transformer class something like this reference implementation to tweak the data in some way.
  3. Export the class to a JAR, and place the JAR in this location:
    • Tarball installs: install-location/resources/solr/lib

    • Packaged installs: /usr/share/dse/solr/lib

    The JAR is added to the CLASSPATH automatically.
  4. Test your implementation using something like the reference implementation.