-
Notifications
You must be signed in to change notification settings - Fork 5
/
fbo_js.js
42 lines (39 loc) · 1.39 KB
/
fbo_js.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
var checkDoc = function (doc) {
var e = java.lang.Exception;
var keywords = ["RFID", "PHP", "Java", "JavaScript", ]
if (doc !== null && doc.getId() !== null) {
try {
if (doc.getId().contains("s=opportunity")) {
var hasKeyword = false;
var content = doc.getFirstFieldValue("body");
if (content !== null) {
for (var i = 0; i < keywords.length; i++) {
var keyword = keywords[i];
if(content.contains(keyword)){
hasKeyword = true;
}
}
if (hasKeyword) {
logger.info("VALID opportunity found: " + doc.getId());
} else {
doc.setId("NA");
doc.setField("body", "");
doc.setField("_raw_content_", "");
}
}
} else {
doc.setId("NA");
doc.setField("body", "");
doc.setField("_raw_content_", "");
}
} catch (e) {
logger.error(e);
}
}
return doc;
}