refactor rebuild_zebra: new routine for invoking zebraidx
Created a routine for calling zebraidx, replacing separate invocations for bibs and authorities. Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
ae8a76dacc
commit
f98c27a8bc
|
|
@ -144,9 +144,7 @@ if ($authorities) {
|
|||
print "====================\n";
|
||||
print "REINDEXING zebra\n";
|
||||
print "====================\n";
|
||||
system("zebraidx -c ".C4::Context->zebraconfig('authorityserver')->{config}." -g iso2709 -d authorities init") if ($reset);
|
||||
system("zebraidx -c ".C4::Context->zebraconfig('authorityserver')->{config}." $noshadow -g iso2709 -d authorities update $directory/authorities");
|
||||
system("zebraidx -c ".C4::Context->zebraconfig('authorityserver')->{config}." -g iso2709 -d authorities commit") unless $noshadow;
|
||||
do_indexing('authority', 'update', "$directory/authorities", $reset, $noshadow, 'iso2709');
|
||||
} else {
|
||||
print "skipping authorities\n";
|
||||
}
|
||||
|
|
@ -383,9 +381,7 @@ if ($biblios) {
|
|||
print "REINDEXING zebra\n";
|
||||
print "====================\n";
|
||||
my $record_fmt = ($as_xml) ? 'marcxml' : 'iso2709' ;
|
||||
system("zebraidx -g $record_fmt -c ".C4::Context->zebraconfig('biblioserver')->{config}." -d biblios init") if ($reset);
|
||||
system("zebraidx -g $record_fmt -c ".C4::Context->zebraconfig('biblioserver')->{config}." $noshadow -d biblios update $directory/biblios");
|
||||
system("zebraidx -g $record_fmt -c ".C4::Context->zebraconfig('biblioserver')->{config}." -d biblios commit") unless $noshadow;
|
||||
do_indexing('biblio', 'update', "$directory/biblios", $reset, $noshadow, $record_fmt);
|
||||
} else {
|
||||
print "skipping biblios\n";
|
||||
}
|
||||
|
|
@ -414,6 +410,20 @@ if ($keep_export) {
|
|||
}
|
||||
}
|
||||
|
||||
sub do_indexing {
|
||||
my ($record_type, $op, $record_dir, $reset_index, $noshadow, $record_format) = @_;
|
||||
|
||||
my $zebra_server = ($record_type eq 'biblio') ? 'biblioserver' : 'authorityserver';
|
||||
my $zebra_db_name = ($record_type eq 'biblio') ? 'biblios' : 'authorities';
|
||||
my $zebra_config = C4::Context->zebraconfig($zebra_server)->{'config'};
|
||||
my $zebra_db_dir = C4::Context->zebraconfig($zebra_server)->{'directory'};
|
||||
|
||||
system("zebraidx -c $zebra_config -g $record_format -d $zebra_db_name init") if $reset_index;
|
||||
system("zebraidx -c $zebra_config $noshadow -g $record_format -d $zebra_db_name $op $record_dir");
|
||||
system("zebraidx -c $zebra_config -g $record_format -d $zebra_db_name commit") unless $noshadow;
|
||||
|
||||
}
|
||||
|
||||
sub print_usage {
|
||||
print <<_USAGE_;
|
||||
$0: reindex MARC bibs and/or authorities in Zebra.
|
||||
|
|
|
|||
Loading…
Reference in New Issue