2 This is a basic skeleton JavaScript update processor.
4 In order for this to be executed, it must be properly wired into solrconfig.xml; by default it is commented out in
5 the example solrconfig.xml and must be uncommented to be enabled.
7 See http://wiki.apache.org/solr/ScriptUpdateProcessor for more details.
10 function processAdd(cmd) {
12 doc = cmd.solrDoc; // org.apache.solr.common.SolrInputDocument
13 id = doc.getFieldValue("id");
14 logger.info("update-script#processAdd: id=" + id);
17 // doc.setField("foo_s", "whatever");
19 // Get a configuration parameter:
20 // config_param = params.get('config_param'); // "params" only exists if processor configured with <lst name="params">
22 // Get a request parameter:
23 // some_param = req.getParams().get("some_param")
25 // Add a field of field names that match a pattern:
26 // - Potentially useful to determine the fields/attributes represented in a result set, via faceting on field_name_ss
27 // field_names = doc.getFieldNames().toArray();
28 // for(i=0; i < field_names.length; i++) {
29 // field_name = field_names[i];
30 // if (/attr_.*/.test(field_name)) { doc.addField("attribute_ss", field_names[i]); }
35 function processDelete(cmd) {
39 function processMergeIndexes(cmd) {
43 function processCommit(cmd) {
47 function processRollback(cmd) {