old records win by default now
[migration-tools.git] / fingerprinter
index 0bee304..b7319c6 100755 (executable)
@@ -74,7 +74,7 @@ sub populate_marc {
 
     # date1, date2
     my $my_008 = $record->field('008');
-    $marc{tag008} = $my_008->as_string();# if ($my_008);
+    $marc{tag008} = $my_008->as_string() if ($my_008);
     if (defined $marc{tag008}) {
         unless (length $marc{tag008} == 40) {
             $marc{tag008} = $marc{tag008} . ('|' x (40 - length($marc{tag008})));
@@ -225,7 +225,9 @@ sub score_marc {
     #----------------------------------
     # static criteria scoring
     #----------------------------------
-    $marc->{misc_score} = 999;
+    $marc->{misc_score} = 999999999999;
+    # subtract record id if we want older records to win
+    $marc->{misc_score} -= $marc->{id} unless ($conf->{newwins});
     # -1 if 008 has been padded, -2 if it doesn't exist
     if ($marc->{tag008})
       { $marc->{misc_score}-- if ($marc->{tag008} =~ /\|$/) }
@@ -401,6 +403,7 @@ sub initialize {
                          'tag|t=s',
                          'fingerprints=s',
                          'scores=s',
+                         'newwins',
                          'quiet|q',
                          'help|h',
                        );
@@ -499,6 +502,7 @@ Options
 
   --scores=LIST  Scores to calculate, comma separated
                  Default: oclc,dlc,num_650,num_tags,enc_level
+  --newwins      New record IDs score higher (default is old wins)
 
   --marctype=TYPE Defaults to 'XML'
 HELP