Custom URP example (deprecated)

The DSE custom URP implementation is deprecated. A custom URP is almost always unnecessary. Instead, DataStax recommends using the field input/output transformer (FIT) API. Note that the FIT requires a trailing Z for date field values.

DSE Search 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. The plugin to the CassandraDocumentReader transforms the results data from the database to DSE Search.

Using the API, applications can tweak a search document before it is mapped and indexed according to the index schema.

To use the API, do the following:

  1. Configure the custom URP in your solrconfig.xml:

    solrconfig.xml
    <dseUpdateRequestProcessorChain name="dse">
     <processor class="com.datastax.bdp.search.solr.functional.{product-short}UpdateRequestProcessorFactoryExample">
     </processor>
    </dseUpdateRequestProcessorChain>
  2. Write a class to use the custom URP that extends the Solr UpdateRequestProcessor. For example:

    package com.datastax.bdp.search.solr.functional;
    
    import java.io.IOException;
    
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    
    import com.datastax.bdp.search.solr.handler.update.CassandraAddUpdateCommand;
    import com.datastax.bdp.search.solr.handler.update.CassandraCommitUpdateCommand;
    import org.apache.solr.update.AddUpdateCommand;
    import org.apache.solr.update.CommitUpdateCommand;
    import org.apache.solr.update.processor.UpdateRequestProcessor;
    
    public class TestUpdateRequestProcessor extends UpdateRequestProcessor
    {
        protected final Logger logger = LoggerFactory.getLogger(TestUpdateRequestProcessor.class);
    
        public TestUpdateRequestProcessor(UpdateRequestProcessor next)
        {
            super(next);
        }
    
        public void processAdd(AddUpdateCommand cmd) throws IOException
        {
            if (cmd instanceof CassandraAddUpdateCommand)
            {
                logger.info("Processing Cassandra-actuated document update.");
            }
            else
            {
                logger.info("Processing HTTP-based document update.");
            }
    
            super.processAdd(cmd);
        }
    
        public void processCommit(CommitUpdateCommand cmd) throws IOException
        {
            if (cmd instanceof CassandraCommitUpdateCommand)
            {
                logger.info("Processing DSE-actuated commit.");
            }
            else
            {
                logger.info("Processing client-actuated commit.");
            }
            super.processCommit(cmd);
        }
    }
  3. Export the class to a JAR, and place the JAR in the location for your installation type. The JAR is added to the CLASSPATH automatically.

    • Tarball installations: <install-location>/resources/solr/lib

    • Package installations: /usr/share/dse/solr/lib

  4. Test your implementation. For example:

    package com.datastax.bdp.search.solr.functional;
    
    import com.datastax.bdp.search.solr.handler.update.DSEUpdateProcessorFactory;
    import org.apache.solr.core.SolrCore;
    import org.apache.solr.update.processor.UpdateRequestProcessor;
    
    public class DSEUpdateRequestProcessorFactoryExample extends DSEUpdateProcessorFactory
    {
        SolrCore core;
    
        public DSEUpdateRequestProcessorFactoryExample(SolrCore core) {
            this.core = core;
        }
    
        public UpdateRequestProcessor getInstance(
                UpdateRequestProcessor next)
        {
            return new TestUpdateRequestProcessor(next);
        }
    }

Was this helpful?

Give Feedback

How can we improve the documentation?

© Copyright IBM Corporation 2025 | Privacy policy | Terms of use Manage Privacy Choices

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: Contact IBM