Browse Source

adding a new option, -w, which disables shadow indexing for the current batch (faster indexing of large sets where ACID isn't critical)

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
3.0.x
Joshua Ferraro 17 years ago
parent
commit
c6ddddad98
  1. 42
      misc/migration_tools/rebuild_zebra.pl

42
misc/migration_tools/rebuild_zebra.pl

@ -25,17 +25,19 @@ my $reset;
my $biblios; my $biblios;
my $authorities; my $authorities;
my $noxml; my $noxml;
my $noshadow;
my $do_munge; my $do_munge;
my $want_help; my $want_help;
my $result = GetOptions( my $result = GetOptions(
'd:s' => \$directory, 'd:s' => \$directory,
'reset' => \$reset, 'reset' => \$reset,
's' => \$skip_export, 's' => \$skip_export,
'k' => \$keep_export, 'k' => \$keep_export,
'b' => \$biblios, 'b' => \$biblios,
'noxml' => \$noxml, 'noxml' => \$noxml,
'munge-config' => \$do_munge, 'w' => \$noshadow,
'a' => \$authorities, 'munge-config' => \$do_munge,
'a' => \$authorities,
'h|help' => \$want_help, 'h|help' => \$want_help,
); );
@ -51,6 +53,9 @@ if (not $biblios and not $authorities) {
die $msg; die $msg;
} }
if ($noshadow) {
$noshadow = ' -n ';
}
my $use_tempdir = 0; my $use_tempdir = 0;
unless ($directory) { unless ($directory) {
$use_tempdir = 1; $use_tempdir = 1;
@ -118,7 +123,7 @@ if ($authorities) {
print " There was some pb getting authority : ".$authid."\n"; print " There was some pb getting authority : ".$authid."\n";
next; next;
} }
print "."; print ".";
print "\r$i" unless ($i++ %100); print "\r$i" unless ($i++ %100);
# # remove leader length, that could be wrong, it will be calculated automatically by as_usmarc # # remove leader length, that could be wrong, it will be calculated automatically by as_usmarc
@ -139,8 +144,8 @@ if ($authorities) {
print "REINDEXING zebra\n"; print "REINDEXING zebra\n";
print "====================\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}." -g iso2709 -d authorities init") if ($reset);
system("zebraidx -c ".C4::Context->zebraconfig('authorityserver')->{config}." -g iso2709 -d authorities update $directory/authorities"); 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"); system("zebraidx -c ".C4::Context->zebraconfig('authorityserver')->{config}." -g iso2709 -d authorities commit") unless $noshadow;
} else { } else {
print "skipping authorities\n"; print "skipping authorities\n";
} }
@ -166,7 +171,7 @@ if ($biblios) {
open(OUT,">:utf8 ","$directory/biblios/export") or die $!; open(OUT,">:utf8 ","$directory/biblios/export") or die $!;
my $dbh=C4::Context->dbh; my $dbh=C4::Context->dbh;
my $sth; my $sth;
if ($noxml){ if ($noxml){
$sth=$dbh->prepare("select biblionumber,marc from biblioitems order by biblionumber $limit"); $sth=$dbh->prepare("select biblionumber,marc from biblioitems order by biblionumber $limit");
$sth->execute(); $sth->execute();
my $i=0; my $i=0;
@ -363,7 +368,7 @@ if ($biblios) {
print OUT $record->as_usmarc(); print OUT $record->as_usmarc();
} }
close(OUT); close(OUT);
} }
} }
# #
@ -373,8 +378,8 @@ if ($biblios) {
print "REINDEXING zebra\n"; print "REINDEXING zebra\n";
print "====================\n"; print "====================\n";
system("zebraidx -g iso2709 -c ".C4::Context->zebraconfig('biblioserver')->{config}." -d biblios init") if ($reset); system("zebraidx -g iso2709 -c ".C4::Context->zebraconfig('biblioserver')->{config}." -d biblios init") if ($reset);
system("zebraidx -g iso2709 -c ".C4::Context->zebraconfig('biblioserver')->{config}." -d biblios update $directory/biblios"); system("zebraidx -g iso2709 -c ".C4::Context->zebraconfig('biblioserver')->{config}." $noshadow -d biblios update $directory/biblios");
system("zebraidx -g iso2709 -c ".C4::Context->zebraconfig('biblioserver')->{config}." -d biblios commit"); system("zebraidx -g iso2709 -c ".C4::Context->zebraconfig('biblioserver')->{config}." -d biblios commit") unless $noshadow;
} else { } else {
print "skipping biblios\n"; print "skipping biblios\n";
} }
@ -414,7 +419,9 @@ mode, this job should not be used.
Parameters: Parameters:
-b index bibliographic records -b index bibliographic records
-a index authority records -a index authority records
-r clear Zebra index before -r clear Zebra index before
adding records to index adding records to index
@ -423,7 +430,9 @@ Parameters:
created. The export directory created. The export directory
is automatically deleted unless is automatically deleted unless
you supply the -k switch. you supply the -k switch.
-k Do not delete export directory. -k Do not delete export directory.
-s Skip export. Used if you have -s Skip export. Used if you have
already exported the records already exported the records
in a previous run. in a previous run.
@ -432,6 +441,9 @@ Parameters:
instead of MARC XML. This instead of MARC XML. This
option is recommended only option is recommended only
for advanced user. for advanced user.
-w skip shadow indexing for this batch
-munge-config Deprecated option to try -munge-config Deprecated option to try
to fix Zebra config files. to fix Zebra config files.
--help or -h show this message. --help or -h show this message.

Loading…
Cancel
Save