[ 
https://issues.apache.org/jira/browse/SOLR-1725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805254#action_12805254
 ] 

Uri Boness commented on SOLR-1725:
----------------------------------

bq. 1) what is the value add in making ScriptUpdateProcessorFactory support 
multiple "scripts" ? ... wouldn't it be simpler to require that users declare 
multiple instances of ScriptUpdateProcessorFactory (that hte processor chain 
already executes in sequence) then to add sequential processing to the 
ScriptUpdateProcessor?

Well... to my taste it makes the configuration cleaner (no need to define 
several script processors). The thing is, you have the choice here - either 
specify several scripts (comma separated) or split them to several processors.

bq. 2) The NamedList init args can be as deep of a data structure as you want, 
so something like this would be totally feasible (if desired) ...

That's definitely another option.

The only thing is that you'd probably want some way to define shared parameters 
(shared between the scripts that is) and not be forced to specify them several 
times for each script. I guess you can do something like this:

{code}
<processor class="solr.ScriptUpdateProcessorFactory">
  <lst name="sharedParams">
    <bool name="paramName">true</bool>
  </lst>
  <lst name="scripts">
    <lst name="updateProcessor1.js">
      <bool name="someParamName">true</bool>
      <int name="someOtherParamName">3</int>
    </lst>
    <lst name="updateProcessor2.js">
      <bool name="fooParam">true</bool>
      <str name="barParam">3</str>
    </lst>
  </lst>
  <lst name="otherProcessorOPtionsIfNeeded">
    ...
  </lst>
</processor>
{code}

> Script based UpdateRequestProcessorFactory
> ------------------------------------------
>
>                 Key: SOLR-1725
>                 URL: https://issues.apache.org/jira/browse/SOLR-1725
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>    Affects Versions: 1.4
>            Reporter: Uri Boness
>         Attachments: SOLR-1725.patch, SOLR-1725.patch, SOLR-1725.patch, 
> SOLR-1725.patch, SOLR-1725.patch
>
>
> A script based UpdateRequestProcessorFactory (Uses JDK6 script engine 
> support). The main goal of this plugin is to be able to configure/write 
> update processors without the need to write and package Java code.
> The update request processor factory enables writing update processors in 
> scripts located in {{solr.solr.home}} directory. The functory accepts one 
> (mandatory) configuration parameter named {{scripts}} which accepts a 
> comma-separated list of file names. It will look for these files under the 
> {{conf}} directory in solr home. When multiple scripts are defined, their 
> execution order is defined by the lexicographical order of the script file 
> name (so {{scriptA.js}} will be executed before {{scriptB.js}}).
> The script language is resolved based on the script file extension (that is, 
> a *.js files will be treated as a JavaScript script), therefore an extension 
> is mandatory.
> Each script file is expected to have one or more methods with the same 
> signature as the methods in the {{UpdateRequestProcessor}} interface. It is 
> *not* required to define all methods, only those hat are required by the 
> processing logic.
> The following variables are define as global variables for each script:
>  * {{req}} - The SolrQueryRequest
>  * {{rsp}}- The SolrQueryResponse
>  * {{logger}} - A logger that can be used for logging purposes in the script

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to