Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
7.0
-
None
-
None
Description
Ref docs::
The TemplateUpdateProcessorFactory can be used to add new fields to documents based on a template pattern.
This can be used directly in a request without any configuration. To enable this processor, use the parameter processor=Template.
Sample curl::
curl -X POST -H 'Content-Type:application/json' 'http://localhost:8983/solr/gettingstarted/update/json/docs?processor=Template&Template.field=fullName_s:AmritSarkar&commit=true' --data-binary '{"id": 1,"title": "titleA"}'
I am receiving exception::
<?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"><int name="status">400</int><int name="QTime">3</int></lst><lst name="error"><lst name="metadata"><str name="error-class">org.apache.solr.common.SolrException</str><str name="root-error-class">org.apache.solr.common.SolrException</str></lst><str name="msg">No such processor Template</str><int name="code">400</int></lst> </response>
ERROR - 2017-06-10 07:39:51.598; [c:gettingstarted s:shard2 r:core_node1 x:gettingstarted_shard2_replica_n1] org.apache.solr.common.SolrException; org.apache.solr.common.SolrException: No such processor Template at org.apache.solr.update.processor.UpdateRequestProcessorChain.getReqProcessors(UpdateRequestProcessorChain.java:286) at org.apache.solr.update.processor.UpdateRequestProcessorChain.constructChain(UpdateRequestProcessorChain.java:235)
I looked into how the testclass has been created::
TemplateUpdateProcessorTest::
public void testSimple() throws Exception { AddUpdateCommand cmd = new AddUpdateCommand(new LocalSolrQueryRequest(null, new ModifiableSolrParams() .add("processor", "Template") .add("Template.field", "id:${firstName}_${lastName}") .add("Template.field", "another:${lastName}_${firstName}") .add("Template.field", "missing:${lastName}_${unKnown}") )); cmd.solrDoc = new SolrInputDocument(); cmd.solrDoc.addField("firstName", "Tom"); cmd.solrDoc.addField("lastName", "Cruise"); new TemplateUpdateProcessorFactory().getInstance(cmd.getReq(), new SolrQueryResponse(), null).processAdd(cmd); assertEquals("Tom_Cruise", cmd.solrDoc.getFieldValue("id")); assertEquals("Cruise_Tom", cmd.solrDoc.getFieldValue("another")); assertEquals("Cruise_", cmd.solrDoc.getFieldValue("missing")); }
There is no test to check whether processor=Template works or not, TemplateUpdateProcessorFactory() object is EXPLICITLY created to getInstance and do processing on the updates.
Attachments
Attachments
Issue Links
- is a clone of
-
SOLR-10876 Regression in loading runtime UpdateRequestProcessors
- Resolved