[ 
https://issues.apache.org/jira/browse/SOLR-10865?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Amrit Sarkar updated SOLR-10865:
--------------------------------
    Attachment: SOLR-10865.patch

Figured out what the problem is =>

To leverage the _processor=Template_ or _processor=Atomic_ or _processor = X_, 
where X + "UpdateRequestProcessor", must and must have system property 
*-Denable.runtime.lib=true*

Now when we start a SolrCloud with default settings, I don't think we have 
*enable.runtime.lib* enabled in our configs. And the error we receive at the 
end of the request is:
{code}
2017-06-12 11:05:55.517 WARN  (qtp846947180-13) [c:gettingstarted s:shard1 
r:core_node1 x:gettingstarted_shard1_replica_n1] o.a.s.c.PluginBag runtime 
library loading is not enabled, start Solr with -Denable.runtime.lib=true
org.apache.solr.common.SolrException; org.apache.solr.common.SolrException: No 
such processor Template
{code}
absolutely misleading. I guess improving the error message will make the user 
make the necessary changes to make it work. A nested message is better to fix 
this.

Patch attached with appropriate error or exception, which will help one figure 
out what to fix, where to fix when we see "No processor".

> 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
>         Attachments: SOLR-10865.patch
>
>
> 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.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to