[open-ils-commits] r20007 - branches/rel_2_1/Open-ILS/src/extras/import (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Apr 6 17:06:23 EDT 2011
Author: dbs
Date: 2011-04-06 17:06:17 -0400 (Wed, 06 Apr 2011)
New Revision: 20007
Modified:
branches/rel_2_1/Open-ILS/src/extras/import/marc2sre.pl
Log:
Improve error handling in marc2sre.pl when bib ID is not found
If we can't find a bibliographic record ID to use in our load, then
skip that MFHD record and move on to the next one. Using the counter
gives sites a chance to identify which record caused the problem.
Aside: bitmap index scans for leading '%' LIKE searches make the
--bibfield / --bibsubfield extremely slow in large datasets. If
at all possible, avoid this path!
Modified: branches/rel_2_1/Open-ILS/src/extras/import/marc2sre.pl
===================================================================
--- branches/rel_2_1/Open-ILS/src/extras/import/marc2sre.pl 2011-04-06 21:03:32 UTC (rev 20006)
+++ branches/rel_2_1/Open-ILS/src/extras/import/marc2sre.pl 2011-04-06 21:06:17 UTC (rev 20007)
@@ -87,18 +87,28 @@
} else {
$record_field = $rec->field($idfield);
}
+
+ # Start by just using the counter as the record ID
my $record = $count;
+ # If we have identified a location for the bib record ID, grab that value
if ($record_field) {
$record = $record_field->data;
}
+ # If we didn't get a bib record ID, skip and move on to the next MFHD record
+ if (!$record) {
+ print STDERR "Could not find a bibliographic record ID link for record $count\n";
+ next;
+ }
+
# If we have been given bibfield / bibsubfield values, use those to find
# a matching bib record for $record and use _that_ as our record instead
if ($bibfield) {
my ($result, $evt) = map_id_to_bib($record);
- if ($evt || !$result->record) {
- print("Could not find matching bibliographic record for $record\n");
+ if ($evt || !$result || !$result->record) {
+ print STDERR "Could not find matching bibliographic record for record $count\n";
+ next;
}
$record = $result->record;
} else {
More information about the open-ils-commits
mailing list