Skip to content

Commit

Permalink
Correct loading format classifier for indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
mdnoble73 committed May 12, 2024
1 parent ed7f6fb commit 2789e8a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
Binary file modified code/reindexer/reindexer.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,20 @@ public LinkedHashSet<FormatInfo> getFormatsForRecord(org.marc4j.marc.Record reco
}
}

/**
* Retrieve a format from the specified fallback field. This is untranslated because it gets translated later.
*
* @param record
* @param printFormats
* @param settings
*/
protected void getFormatFromFallbackField(org.marc4j.marc.Record record, LinkedHashSet<String> printFormats, BaseIndexingSettings settings) {
if (settings instanceof IndexingProfile) {
IndexingProfile indexingProfile = (IndexingProfile)settings;
Set<String> fields = MarcUtil.getFieldList(record, indexingProfile.getFallbackFormatField());
for (String curField : fields) {
if (indexingProfile.hasTranslation("format", curField.toLowerCase())) {
printFormats.add(indexingProfile.translateValue("format", curField));
printFormats.add( curField);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public LinkedHashSet<FormatInfo> getFormatsForRecord(org.marc4j.marc.Record reco
if (settings instanceof IndexingProfile) {
IndexingProfile profile = (IndexingProfile) settings;
String formatLower = format.toLowerCase();
if (profile.hasTranslation("format", formatLower)) {
formatInfo.format = profile.translateValue("format", formatLower);
}
if (profile.hasTranslation("format_category", formatLower)) {
formatInfo.formatCategory = profile.translateValue("format_category", formatLower);
}else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import com.turning_leaf_technologies.marc.MarcUtil;
import com.turning_leaf_technologies.strings.AspenStringUtils;
import org.apache.logging.log4j.Logger;
import org.aspen_discovery.format_classification.IIIRecordFormatClassifier;
import org.aspen_discovery.format_classification.IlsRecordFormatClassifier;
import org.aspen_discovery.format_classification.KohaRecordFormatClassifier;
import org.aspen_discovery.format_classification.NashvilleRecordFormatClassifier;
import org.marc4j.marc.*;

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

//Setup format classifier
switch (settings.getIndexingClass()) {
case "III":
formatClassifier = new IIIRecordFormatClassifier(logger);
break;
case "Koha":
formatClassifier = new KohaRecordFormatClassifier(logger);
break;
case "NashvilleCarlX":
formatClassifier = new NashvilleRecordFormatClassifier(logger);
break;
default:
formatClassifier = new IlsRecordFormatClassifier(logger);
break;
}

try {
String pattern = indexingProfileRS.getString("nonHoldableITypes");
if (pattern != null && !pattern.isEmpty()) {
Expand Down Expand Up @@ -1628,7 +1648,8 @@ public void loadPrintFormatInformation(RecordInfo recordInfo, org.marc4j.marc.Re
largePrintCheck(recordInfo, record);
return;
}
} if (recordInfo.hasItemFormats() && !recordInfo.allItemsHaveFormats()){
}
if (recordInfo.hasItemFormats() && !recordInfo.allItemsHaveFormats()){
//We're doing bib level formats, but we got some item level formats (probably eContent or something)
loadPrintFormatFromBib(recordInfo, record);
for (ItemInfo itemInfo : recordInfo.getRelatedItems()){
Expand Down

0 comments on commit 2789e8a

Please sign in to comment.