|
Lines 75-80
my $framework = '';
Link Here
|
| 75 |
my $localcust; |
75 |
my $localcust; |
| 76 |
my $marc_mod_template = ''; |
76 |
my $marc_mod_template = ''; |
| 77 |
my $marc_mod_template_id = -1; |
77 |
my $marc_mod_template_id = -1; |
|
|
78 |
my $skip_indexing = 0; |
| 78 |
$| = 1; |
79 |
$| = 1; |
| 79 |
|
80 |
|
| 80 |
GetOptions( |
81 |
GetOptions( |
|
Lines 111-116
GetOptions(
Link Here
|
| 111 |
'framework=s' => \$framework, |
112 |
'framework=s' => \$framework, |
| 112 |
'custom:s' => \$localcust, |
113 |
'custom:s' => \$localcust, |
| 113 |
'marcmodtemplate:s' => \$marc_mod_template, |
114 |
'marcmodtemplate:s' => \$marc_mod_template, |
|
|
115 |
'si|skip_indexing' => \$skip_indexing, |
| 114 |
); |
116 |
); |
| 115 |
|
117 |
|
| 116 |
$biblios ||= !$authorities; |
118 |
$biblios ||= !$authorities; |
|
Lines 128-140
if ($all) {
Link Here
|
| 128 |
my $using_elastic_search = ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ); |
130 |
my $using_elastic_search = ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ); |
| 129 |
my $mod_biblio_options = { |
131 |
my $mod_biblio_options = { |
| 130 |
disable_autolink => $using_elastic_search, |
132 |
disable_autolink => $using_elastic_search, |
| 131 |
skip_record_index => $using_elastic_search, |
133 |
skip_record_index => $using_elastic_search || $skip_indexing, |
| 132 |
overlay_context => { source => 'bulkmarcimport' } |
134 |
overlay_context => { source => 'bulkmarcimport' } |
| 133 |
}; |
135 |
}; |
| 134 |
my $add_biblio_options = { |
136 |
my $add_biblio_options = { |
| 135 |
disable_autolink => $using_elastic_search, |
137 |
disable_autolink => $using_elastic_search, |
| 136 |
skip_record_index => $using_elastic_search |
138 |
skip_record_index => $using_elastic_search || $skip_indexing |
| 137 |
}; |
139 |
}; |
|
|
140 |
my $mod_authority_options = { skip_record_index => $using_elastic_search || $skip_indexing }; |
| 141 |
my $add_authority_options = { skip_record_index => $using_elastic_search || $skip_indexing }; |
| 138 |
|
142 |
|
| 139 |
my @search_engine_record_ids; |
143 |
my @search_engine_record_ids; |
| 140 |
my @search_engine_records; |
144 |
my @search_engine_records; |
|
Lines 465-471
RECORD: foreach my $record ( @{$marc_records} ) {
Link Here
|
| 465 |
if ($matched_record_id) { |
469 |
if ($matched_record_id) { |
| 466 |
if ($update) { |
470 |
if ($update) { |
| 467 |
## Authority has an id and is in database: update |
471 |
## Authority has an id and is in database: update |
| 468 |
eval { ($authid) = ModAuthority( $matched_record_id, $record, $authtypecode ) }; |
472 |
eval { |
|
|
473 |
($authid) = ModAuthority( |
| 474 |
$matched_record_id, $record, $authtypecode, |
| 475 |
$mod_authority_options, |
| 476 |
); |
| 477 |
}; |
| 469 |
if ($@) { |
478 |
if ($@) { |
| 470 |
warn "ERROR: Update authority $matched_record_id failed: $@\n"; |
479 |
warn "ERROR: Update authority $matched_record_id failed: $@\n"; |
| 471 |
printlog( { id => $matched_record_id, op => "update", status => "ERROR" } ) if ($logfile); |
480 |
printlog( { id => $matched_record_id, op => "update", status => "ERROR" } ) if ($logfile); |
|
Lines 485-491
RECORD: foreach my $record ( @{$marc_records} ) {
Link Here
|
| 485 |
} |
494 |
} |
| 486 |
} elsif ($insert) { |
495 |
} elsif ($insert) { |
| 487 |
## An authid is defined but no authority in database: insert |
496 |
## An authid is defined but no authority in database: insert |
| 488 |
eval { ($authid) = AddAuthority( $record, undef, $authtypecode ) }; |
497 |
eval { ($authid) = AddAuthority( $record, undef, $authtypecode, $add_authority_options ); }; |
| 489 |
if ($@) { |
498 |
if ($@) { |
| 490 |
warn "ERROR: Insert authority $originalid failed: $@\n"; |
499 |
warn "ERROR: Insert authority $originalid failed: $@\n"; |
| 491 |
printlog( { id => $originalid, op => "insert", status => "ERROR" } ) if ($logfile); |
500 |
printlog( { id => $originalid, op => "insert", status => "ERROR" } ) if ($logfile); |
|
Lines 680-686
RECORD: foreach my $record ( @{$marc_records} ) {
Link Here
|
| 680 |
$schema->txn_commit; |
689 |
$schema->txn_commit; |
| 681 |
$schema->txn_begin; |
690 |
$schema->txn_begin; |
| 682 |
if ($indexer) { |
691 |
if ($indexer) { |
| 683 |
$indexer->update_index( \@search_engine_record_ids, \@search_engine_records ); |
692 |
$indexer->update_index( \@search_engine_record_ids, \@search_engine_records ) unless $skip_indexing; |
| 684 |
if ( C4::Context->preference('AutoLinkBiblios') ) { |
693 |
if ( C4::Context->preference('AutoLinkBiblios') ) { |
| 685 |
foreach my $record (@search_engine_records) { |
694 |
foreach my $record (@search_engine_records) { |
| 686 |
BiblioAutoLink( $record, $framework ); |
695 |
BiblioAutoLink( $record, $framework ); |
| 687 |
- |
|
|