Package org.apache.solr.update.processor
Class TemplateUpdateProcessorFactory
- java.lang.Object
-
- org.apache.solr.update.processor.UpdateRequestProcessorFactory
-
- org.apache.solr.update.processor.SimpleUpdateProcessorFactory
-
- org.apache.solr.update.processor.TemplateUpdateProcessorFactory
-
- All Implemented Interfaces:
NamedListInitializedPlugin
public class TemplateUpdateProcessorFactory extends SimpleUpdateProcessorFactory
Adds new fields to documents based on a template pattern specified via Template.field request parameters (multi-valued) or 'field' value specified in initArgs.The format of the parameter is <field-name>:<the-template-string>, for example:
Template.field=fname:${somefield}some_string${someotherfield}- Since:
- 6.3.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTemplateUpdateProcessorFactory.Resolved-
Nested classes/interfaces inherited from class org.apache.solr.update.processor.UpdateRequestProcessorFactory
UpdateRequestProcessorFactory.RunAlways
-
-
Field Summary
Fields Modifier and Type Field Description static PatternBRACES_PLACEHOLDER_PATTERNstatic PatternDOLLAR_BRACES_PLACEHOLDER_PATTERNstatic StringNAME-
Fields inherited from class org.apache.solr.update.processor.SimpleUpdateProcessorFactory
initArgs
-
-
Constructor Summary
Constructors Constructor Description TemplateUpdateProcessorFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetMyName()static TemplateUpdateProcessorFactory.ResolvedgetResolved(String template, org.apache.solr.common.util.Cache<String,TemplateUpdateProcessorFactory.Resolved> cache, Pattern pattern)static List<String>getVariables(String template, org.apache.solr.common.util.Cache<String,TemplateUpdateProcessorFactory.Resolved> cache, Pattern pattern)Get a list of variables embedded in the template string.protected voidprocess(AddUpdateCommand cmd, SolrQueryRequest req, SolrQueryResponse rsp)This object is reused across requests.static StringreplaceTokens(String template, org.apache.solr.common.util.Cache<String,TemplateUpdateProcessorFactory.Resolved> cache, Function<String,Object> fun, Pattern pattern)-
Methods inherited from class org.apache.solr.update.processor.SimpleUpdateProcessorFactory
getInstance, getParam, getParams, init
-
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
DOLLAR_BRACES_PLACEHOLDER_PATTERN
public static final Pattern DOLLAR_BRACES_PLACEHOLDER_PATTERN
-
BRACES_PLACEHOLDER_PATTERN
public static final Pattern BRACES_PLACEHOLDER_PATTERN
-
-
Method Detail
-
process
protected void process(AddUpdateCommand cmd, SolrQueryRequest req, SolrQueryResponse rsp)
Description copied from class:SimpleUpdateProcessorFactoryThis object is reused across requests. So,this method should not store anything in the instance variable.- Specified by:
processin classSimpleUpdateProcessorFactory
-
getMyName
protected String getMyName()
- Overrides:
getMyNamein classSimpleUpdateProcessorFactory
-
getResolved
public static TemplateUpdateProcessorFactory.Resolved getResolved(String template, org.apache.solr.common.util.Cache<String,TemplateUpdateProcessorFactory.Resolved> cache, Pattern pattern)
-
getVariables
public static List<String> getVariables(String template, org.apache.solr.common.util.Cache<String,TemplateUpdateProcessorFactory.Resolved> cache, Pattern pattern)
Get a list of variables embedded in the template string.
-
-