Amrit Sarkar created SOLR-10865: ----------------------------------- Summary: parameter processor=Template doesn't invoke TemplateUpdateProcessorFactory. Key: SOLR-10865 URL: https://issues.apache.org/jira/browse/SOLR-10865 Project: Solr Issue Type: Bug Security Level: Public (Default Security Level. Issues are Public) Components: update Affects Versions: master (7.0) Reporter: Amrit Sarkar
Ref docs:: {quote} 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. {quote} Sample curl:: {code} 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"}' {code} I am receiving exception:: {code} <?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> {code} {code} 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) {code} I looked into how the testclass has been created:: TemplateUpdateProcessorTest:: {code} 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")); } {code} *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. -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org