-
Notifications
You must be signed in to change notification settings - Fork 6
/
gettitles.bsh
35 lines (32 loc) · 1.04 KB
/
gettitles.bsh
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
/**
* Custom date script.
*
* This can be used to override built-in SolrMarc custom functions. If you change
* this script, you will need to activate it in import/marc_local.properties before
* it will be applied during indexing.
*/
import org.marc4j.marc.*;
/**
* Get alternative titles for display
*
* @param Record record
* @return Set alternative titles
*/
public Set getAltTitlesForDisplay(Record record) {
Set titles = new LinkedHashSet();
List list246 = record.getVariableFields("246");
for (VariableField vf : list246)
{
DataField df = (DataField) vf;
String currentString = "";
if (df.getIndicator1() == '1' && (df.getIndicator2() == '1' || df.getIndicator2() == '3')) {
for (Subfield current : df.getSubfields()) {
currentString = currentString.trim().concat(" " + current.getData()).trim();
}
if (currentString.length() > 0) {
titles.add(currentString);
}
}
}
return titles;
}