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 topath_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 fieldpath_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
-
-
Constructor Summary
Constructors Constructor Description CmsSolrCopyModifiedUpateProcessorFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods 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.
-
-
-
Constructor Detail
-
CmsSolrCopyModifiedUpateProcessorFactory
public CmsSolrCopyModifiedUpateProcessorFactory()
-
-
Method Detail
-
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 classorg.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.- Specified by:
init
in interfaceorg.apache.solr.util.plugin.NamedListInitializedPlugin
- Overrides:
init
in classorg.apache.solr.update.processor.UpdateRequestProcessorFactory
- See Also:
UpdateRequestProcessorFactory.init(org.apache.solr.common.util.NamedList)
-
-