Skip to content

Commit 2789e8a

Browse files
committed
Correct loading format classifier for indexing
1 parent ed7f6fb commit 2789e8a

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

code/reindexer/reindexer.jar

267 Bytes
Binary file not shown.

code/reindexer/src/org/aspen_discovery/format_classification/IlsRecordFormatClassifier.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,20 @@ public LinkedHashSet<FormatInfo> getFormatsForRecord(org.marc4j.marc.Record reco
4141
}
4242
}
4343

44+
/**
45+
* Retrieve a format from the specified fallback field. This is untranslated because it gets translated later.
46+
*
47+
* @param record
48+
* @param printFormats
49+
* @param settings
50+
*/
4451
protected void getFormatFromFallbackField(org.marc4j.marc.Record record, LinkedHashSet<String> printFormats, BaseIndexingSettings settings) {
4552
if (settings instanceof IndexingProfile) {
4653
IndexingProfile indexingProfile = (IndexingProfile)settings;
4754
Set<String> fields = MarcUtil.getFieldList(record, indexingProfile.getFallbackFormatField());
4855
for (String curField : fields) {
4956
if (indexingProfile.hasTranslation("format", curField.toLowerCase())) {
50-
printFormats.add(indexingProfile.translateValue("format", curField));
57+
printFormats.add( curField);
5158
}
5259
}
5360
}

code/reindexer/src/org/aspen_discovery/format_classification/MarcRecordFormatClassifier.java

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public LinkedHashSet<FormatInfo> getFormatsForRecord(org.marc4j.marc.Record reco
4747
if (settings instanceof IndexingProfile) {
4848
IndexingProfile profile = (IndexingProfile) settings;
4949
String formatLower = format.toLowerCase();
50+
if (profile.hasTranslation("format", formatLower)) {
51+
formatInfo.format = profile.translateValue("format", formatLower);
52+
}
5053
if (profile.hasTranslation("format_category", formatLower)) {
5154
formatInfo.formatCategory = profile.translateValue("format_category", formatLower);
5255
}else{

code/reindexer/src/org/aspen_discovery/reindexer/IlsRecordProcessor.java

+22-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
import com.turning_leaf_technologies.marc.MarcUtil;
77
import com.turning_leaf_technologies.strings.AspenStringUtils;
88
import org.apache.logging.log4j.Logger;
9+
import org.aspen_discovery.format_classification.IIIRecordFormatClassifier;
10+
import org.aspen_discovery.format_classification.IlsRecordFormatClassifier;
11+
import org.aspen_discovery.format_classification.KohaRecordFormatClassifier;
12+
import org.aspen_discovery.format_classification.NashvilleRecordFormatClassifier;
913
import org.marc4j.marc.*;
1014

1115
import java.sql.Connection;
@@ -54,6 +58,22 @@ abstract class IlsRecordProcessor extends MarcRecordProcessor {
5458
super.settings = this.settings;
5559
profileType = indexingProfileRS.getString("name");
5660

61+
//Setup format classifier
62+
switch (settings.getIndexingClass()) {
63+
case "III":
64+
formatClassifier = new IIIRecordFormatClassifier(logger);
65+
break;
66+
case "Koha":
67+
formatClassifier = new KohaRecordFormatClassifier(logger);
68+
break;
69+
case "NashvilleCarlX":
70+
formatClassifier = new NashvilleRecordFormatClassifier(logger);
71+
break;
72+
default:
73+
formatClassifier = new IlsRecordFormatClassifier(logger);
74+
break;
75+
}
76+
5777
try {
5878
String pattern = indexingProfileRS.getString("nonHoldableITypes");
5979
if (pattern != null && !pattern.isEmpty()) {
@@ -1628,7 +1648,8 @@ public void loadPrintFormatInformation(RecordInfo recordInfo, org.marc4j.marc.Re
16281648
largePrintCheck(recordInfo, record);
16291649
return;
16301650
}
1631-
} if (recordInfo.hasItemFormats() && !recordInfo.allItemsHaveFormats()){
1651+
}
1652+
if (recordInfo.hasItemFormats() && !recordInfo.allItemsHaveFormats()){
16321653
//We're doing bib level formats, but we got some item level formats (probably eContent or something)
16331654
loadPrintFormatFromBib(recordInfo, record);
16341655
for (ItemInfo itemInfo : recordInfo.getRelatedItems()){

0 commit comments

Comments
 (0)