lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "ScriptUpdateProcessor" by ErikHatcher
Date Wed, 09 Jan 2013 13:38:14 GMT
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

Mime
View raw message