Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change 
notification.

The "ScriptUpdateProcessor" page has been changed by ErikHatcher:
http://wiki.apache.org/solr/ScriptUpdateProcessor?action=diff&rev1=11&rev2=12

  #  $rsp.add('script_processed',id)       # this is not working!
  }}}
  
+ == Groovy ==
+ 
+ Put all JARs from a Groovy distro's lib/ directory into Solr's resource 
loader (core lib/ directory, <lib> directive in solrconfig, etc).  All JARs 
from Groovy's distro probably aren't required, but more than just the main 
Groovy .jar file is needed (at least when this was tested using Groovy 2.0.6)
+ 
+ example update-script.groovy
+ {{{
+ def processAdd(cmd) {
+   doc = cmd.solrDoc  // org.apache.solr.common.SolrInputDocument
+   id = doc.getFieldValue('id')
+ 
+   logger.info "update-script#processAdd: id=" + id
+ 
+   doc.setField('source_s', 'groovy')
+ 
+   logger.info "update-script#processAdd: config_param=" + 
params.get('config_param')
+ 
+   logger.info "update-script#processAdd: request_param=" + 
req.params.get('request_param')
+   rsp.add('script_processed',id)
+ }
+ 
+ def processDelete(cmd) {
+  //  no-op
+ }
+ 
+ def processMergeIndexes(cmd) {
+  // no-op
+ }
+ 
+ def processCommit(cmd) {
+  //  no-op
+ }
+ 
+ def processRollback(cmd) {
+  // no-op
+ }
+ 
+ def finish() {
+  // no-op
+ }
+ }}}
+ 
  == Jython ==
  
    TODO

Reply via email to