source: gs3-extensions/solr/trunk/src/conf/update-script.js@ 29135

Last change on this file since 29135 was 29135, checked in by ak19, 10 years ago

Part of port from lucene3.3.0 to lucene4.7.2. Solr related. conf and lib folders for solr4.7.2.

File size: 1.4 KB
Line 
1/*
2 This is a basic skeleton JavaScript update processor.
3
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.
6
7 See http://wiki.apache.org/solr/ScriptUpdateProcessor for more details.
8*/
9
10function processAdd(cmd) {
11
12 doc = cmd.solrDoc; // org.apache.solr.common.SolrInputDocument
13 id = doc.getFieldValue("id");
14 logger.info("update-script#processAdd: id=" + id);
15
16// Set a field value:
17// doc.setField("foo_s", "whatever");
18
19// Get a configuration parameter:
20// config_param = params.get('config_param'); // "params" only exists if processor configured with <lst name="params">
21
22// Get a request parameter:
23// some_param = req.getParams().get("some_param")
24
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]); }
31// }
32
33}
34
35function processDelete(cmd) {
36 // no-op
37}
38
39function processMergeIndexes(cmd) {
40 // no-op
41}
42
43function processCommit(cmd) {
44 // no-op
45}
46
47function processRollback(cmd) {
48 // no-op
49}
50
51function finish() {
52 // no-op
53}
Note: See TracBrowser for help on using the repository browser.