Class CmsSolrCopyModifiedUpateProcessorFactory

java.lang.Object
org.apache.solr.update.processor.UpdateRequestProcessorFactory
org.opencms.search.solr.updateprocessors.CmsSolrCopyModifiedUpateProcessorFactory
All Implemented Interfaces:
org.apache.solr.util.plugin.NamedListInitializedPlugin

public class CmsSolrCopyModifiedUpateProcessorFactory extends org.apache.solr.update.processor.UpdateRequestProcessorFactory
An updated processor that applies a configured regex to any CharSequence values found in the source field, replaces any matches with the configured replacement string, and writes the resulting string to the target field.

For example, with the configuration listed below, the sequence in field path will be matched against the regex (.*)_([a-z]{2}(?:_[A-Z]{2})?)((?:\.[^\.]*)?)$, where matched parts will be replaced by $1$3, i.e., the first and third group of the match. The resulting sequence will be written to path_remove_locale.

 <processor class="org.opencms.search.solr.updateprocessors.CmsSolrCopyModifiedUpateProcessorFactory">
   <str name="source">path</str>
   <str name="target">path_remove_locale</str>
   <str name="regex">(.*)_([a-z]{2}(?:_[A-Z]{2})?)((?:\.[^\.]*)?)$</str>
   <str name="replacement">$1$3</str>
 </processor>

If, e.g., a document with value "document_de.txt" in field source is processed, the field path_remove_locale with value "document.txt will be added.

To add the update processor to your installation, define an update processor chain as in the following example.

 <updateRequestProcessorChain name="mychain" default="true">
   <processor class="org.opencms.search.solr.updateprocessors.CmsSolrCopyModifiedUpateProcessorFactory">
     <str name="source">path</str>
     <str name="target">path_remove_locale</str>
     <str name="regex">(.*)_([a-z]{2}(?:_[A-Z]{2})?)((?:\.[^\.]*)?)$</str>
     <str name="replacement">$1$3</str>
   </processor>
   <processor class="solr.LogUpdateProcessorFactory" />
   <processor class="solr.RunUpdateProcessorFactory" />
 </updateRequestProcessorChain>
See Also:
  • UpdateRequestProcessorChain
  • Pattern
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.solr.update.processor.UpdateRequestProcessorFactory

    org.apache.solr.update.processor.UpdateRequestProcessorFactory.RunAlways
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.solr.update.processor.UpdateRequestProcessor
    getInstance(org.apache.solr.request.SolrQueryRequest req, org.apache.solr.response.SolrQueryResponse rsp, org.apache.solr.update.processor.UpdateRequestProcessor next)
     
    void
    init(org.apache.solr.common.util.NamedList args)
    Read the parameters on initialization.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getInstance

      public org.apache.solr.update.processor.UpdateRequestProcessor getInstance(org.apache.solr.request.SolrQueryRequest req, org.apache.solr.response.SolrQueryResponse rsp, org.apache.solr.update.processor.UpdateRequestProcessor next)
      Specified by:
      getInstance in class org.apache.solr.update.processor.UpdateRequestProcessorFactory
      See Also:
      • UpdateRequestProcessorFactory.getInstance(org.apache.solr.request.SolrQueryRequest, org.apache.solr.response.SolrQueryResponse, org.apache.solr.update.processor.UpdateRequestProcessor)
    • init

      public void init(org.apache.solr.common.util.NamedList args)
      Read the parameters on initialization.
      See Also:
      • NamedListInitializedPlugin.init(org.apache.solr.common.util.NamedList)