LP#1279998 marc_stream_importer support alternate match strategies
authorBill Erickson <berick@esilibrary.com>
Wed, 12 Feb 2014 15:18:39 +0000 (10:18 -0500)
committerBen Shum <bshum@biblio.org>
Wed, 6 Aug 2014 19:22:40 +0000 (15:22 -0400)
Adds support for sending auto-overlay-1match and auto-overlay-best-match
in addition to auto-overlay-exact to Vandelay when performing the
import.  If no strategy is chosen, the script still defaults to
auto-overlay-exact.

These changes are managed with 3 new command line options:

--auto-overlay-exact
--auto-overlay-1match
--auto-overlay-best-match

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/support-scripts/marc_stream_importer.pl

index d288504..bdb740b 100755 (executable)
@@ -54,7 +54,10 @@ my %defaults = (
     'noqueue'       => 0,
     'nodaemon'      => 0,
     'wait=i'        => 5,
-    'import-by-queue' => 0
+    'import-by-queue' => 0,
+    'auto-overlay-exact' => 0,
+    'auto-overlay-1match' => 0,
+    'auto-overlay-best-match' => 0
 );
 
 $OpenILS::Utils::Cronscript::debug=1 if $debug;
@@ -250,11 +253,15 @@ sub process_spool { # filename
 
 sub bib_queue_import {
     my $rec_ids = shift;
-    my $extra = {
-        auto_overlay_exact => 1,
-        import_no_match    => 1,
-    };
+    my $extra = {import_no_match => 1};
     $extra->{merge_profile} = $merge_profile if $merge_profile;
+    $extra->{auto_overlay_1match} = 1 if $real_opts->{'auto-overlay-1match'};
+    $extra->{auto_overlay_best_match} = 1 if $real_opts->{'auto-overlay-best-match'};
+
+    # default to exact match if no strategy is chosen
+    $extra->{auto_overlay_exact} = 1 
+        if $real_opts->{'auto-overlay-exact'} or
+        not ($extra->{auto_overlay_1match} or $extra->{auto_overlay_best_match});
 
     my $req;
     my @cleanup_recs;