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

David Smiley commented on SOLR-7576:
------------------------------------

I've vaguely heard of the new blob store & signing.  I took a look at 
https://cwiki.apache.org/confluence/display/solr/Adding+Custom+Plugins+in+SolrCloud+Mode
   I get that it's secure but following that would be a real PITA during 
development.  Is there a faster way to to redeploy a changed file during 
development?  Maybe a simple script could do that?  Or better yet, a mode 
during development that would simply pick up the change from the file system.  
Oh wait; in a SolrCloud/ZooKeeper world, that may not make sense.  Hmmmm :-/  
Related to this is the possibility of introducing some sort of 
AbstractSolrTestCase thingamagic (or new subclass) to test that a request 
employing some specific JavaScript (but defined in the test or as a test 
resource) is working.  That could lead to a faster dev cycle, and it encourages 
testing.

How does one go about logging? (again, not necessarily for real/production but 
for development to inspect what the heck some object is or its members).

The examples look nice; I like the use of '$'.  It'd be nice to see an example 
of taking the response of a query to pull out it's contents.

I understand that JS is a first-class-citizen but if I want to use something 
else, like Groovy, is that possible?  What remains?  Did you look at SOLR-5005?

> Implement RequestHandler in Javascript
> --------------------------------------
>
>                 Key: SOLR-7576
>                 URL: https://issues.apache.org/jira/browse/SOLR-7576
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Noble Paul
>         Attachments: SOLR-7576.patch, SOLR-7576.patch
>
>
> Solr now support dynamic loading (SOLR-7073) of components and it is secured 
> in SOLR-7126
> We can extend the same functionality with JS as well
> the handler {{/js}} is implicitly registered
> To make this work
> * Solr should be started with {{-Denable.js.loading=true}}
> * The javascript must be loaded to the {{.system}} collection using the blob 
> store API
> * Configure the requesthandler with the JS blob name and version
> * Sign the javascript and pass the signature in a param called {{_sig}}
> The {{JSRequestHandler}} is implicitly defined and it can be accessed by 
> hitting {{/js/<jsname>/<version>}} 
> sample programs
> 1) writes a val to output
> {code:javascript}
> //empty line
> $.response().add('testkey','Test Val');
> {code}
> 2)  manipulate the output to add an extra field to each doc 
> {code}
> //empty line
> var l = [];
> $.query({
>               q: '*:*',
>               qt: '/select',
>               start:0,
>           }).forEach('response', function(doc) {
>                                          doc.put('script', 'Added this 
> value');
>                                          l.push(doc);
>           });
>  $.response().add('alldocs', l);
> {code}
> 3)  stream through all the docs
> {code:Javascript}
> $.query({
>               q: '*:*',
>               qt: '/select',
>               start:0,
>               distrib:'false'
>           }).pipe('response', 'docs', function(doc) { // the pipe function is 
> executed right before the response writer and right after the transformers   
>                                          if('IT'== doc.get('genre_s')) return 
> null;
>                                          doc.put('script', 'Added this 
> value');
>                                          return doc;
>           });
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to