From 6b201757c1c14d351baa9b17832543ca46fd05fb Mon Sep 17 00:00:00 2001 From: tipaul Date: Tue, 17 Apr 2007 08:50:33 +0000 Subject: [PATCH] some bugfixes for this script that automatically build zebra DB from default config files --- misc/migration_tools/rebuild_zebra.pl | 175 +++++++++++++------------- 1 file changed, 90 insertions(+), 85 deletions(-) diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl index ac063acff7..5269a63366 100755 --- a/misc/migration_tools/rebuild_zebra.pl +++ b/misc/migration_tools/rebuild_zebra.pl @@ -14,7 +14,7 @@ use strict; $|=1; # flushes output # limit for database dumping -my $limit;# = "LIMIT 500"; +my $limit = "LIMIT 500"; my $directory; my $skip_export; my $keep_export; @@ -204,14 +204,15 @@ if ($authorities) { $created_dir_or_file++; } - unless (-f C4::Context->ModZebrations('authorityserver')->{ccl2rpn}) { - system("cp -f $kohadir/misc/zebra/ccl.properties ".C4::Context->ModZebrations('authorityserver')->{ccl2rpn}); - # system("cp -f $kohadir/misc/zebra/ccl.properties $authorityserverdir/etc/ccl.properties"); + unless (-f C4::Context->zebraconfig('authorityserver')->{ccl2rpn}) { +# system("cp -f $kohadir/misc/zebra/ccl.properties ".C4::Context->zebraconfig('authorityserver')->{ccl2rpn}); + system("cp -f $kohadir/misc/zebra/ccl.properties $authorityserverdir/etc/ccl.properties"); print "Info: copied ccl.properties\n"; $created_dir_or_file++; } unless (-f C4::Context->zebraconfig('authorityserver')->{cql2rpn}) { - system("cp -f $kohadir/misc/zebra/pqf.properties ".C4::Context->zebraconfig('authorityserver')->{cql2rpn}); +# system("cp -f $kohadir/misc/zebra/pqf.properties ".C4::Context->zebraconfig('authorityserver')->{ccl2rpn}); + system("cp -f $kohadir/misc/zebra/pqf.properties $authorityserverdir/etc/pqf.properties"); print "Info: copied pqf.properties\n"; $created_dir_or_file++; } @@ -222,42 +223,42 @@ if ($authorities) { unless (-f C4::Context->zebraconfig('authorityserver')->{config}) { open ZD,">:utf8 ",C4::Context->zebraconfig('authorityserver')->{config}; print ZD " - # generated by KOHA/misc/migration_tools/rebuild_zebra.pl - profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ - - encoding: UTF-8 - # Files that describe the attribute sets supported. - attset: auth1.att - attset: explain.att - attset: gils.att - - modulePath:$modulesdir/modules/ - # Specify record type - iso2709.recordType:grs.marcxml.record - recordType:grs.xml - recordId: (auth1,Local-Number) - storeKeys:1 - storeData:1 - - - # Lock File Area - lockDir: $authorityserverdir/lock - perm.anonymous:r - perm.kohaadmin:rw - passw.kohalis - shadow - register: $authorityserverdir/register:4G - shadow: $authorityserverdir/shadow:4G - - # Temp File area for result sets - setTmpDir: $authorityserverdir/tmp - - # Temp File area for index program - keyTmpDir: $authorityserverdir/key - - # Approx. Memory usage during indexing - memMax: 40M - rank:rank-1 +# generated by KOHA/misc/migration_tools/rebuild_zebra.pl +profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ + +encoding: UTF-8 +# Files that describe the attribute sets supported. +attset: auth1.att +attset: explain.att +attset: gils.att + +modulePath:$modulesdir/modules/ +# Specify record type +iso2709.recordType:grs.marcxml.record +recordType:grs.xml +recordId: (auth1,Local-Number) +storeKeys:1 +storeData:1 + + +# Lock File Area +lockDir: $authorityserverdir/lock +perm.anonymous:r +perm.kohaadmin:rw +passw.kohalis +shadow +register: $authorityserverdir/register:4G +shadow: $authorityserverdir/shadow:4G + +# Temp File area for result sets +setTmpDir: $authorityserverdir/tmp + +# Temp File area for index program +keyTmpDir: $authorityserverdir/key + +# Approx. Memory usage during indexing +memMax: 40M +rank:rank-1 "; print "Info: creating zebra-authorities.cfg\n"; $created_dir_or_file++; @@ -303,9 +304,10 @@ if ($authorities) { print "====================\n"; print "REINDEXING zebra\n"; print "====================\n"; - system("zebraidx -g iso2709 -c ".C4::Context->zebraconfig('authorityserver')->{config}." -d authorities init") if ($reset); - system("zebraidx -g iso2709 -c ".C4::Context->zebraconfig('authorityserver')->{config}." -d authorities update $directory/authorities"); - system("zebraidx -g iso2709 -c ".C4::Context->zebraconfig('authorityserver')->{config}." -d authorities commit"); +warn ">>>>>>>>>>>>>>>".C4::Context->zebraconfig('authorityserver')->{config}; + 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}." -g iso2709 -d authorities commit"); } else { print "skipping authorities\n"; } @@ -391,14 +393,15 @@ if ($biblios) { print "Info: copied default.idx\n"; $created_dir_or_file++; } - unless (-f C4::Context->ModZebrations('biblioserver')->{ccl2rpn}) { - system("cp -f $kohadir/misc/zebra/ccl.properties ".C4::Context->ModZebrations('biblioserver')->{ccl2rpn}); - # system("cp -f $kohadir/misc/zebra/ccl.properties $biblioserverdir/etc/ccl.properties"); + unless (-f C4::Context->zebraconfig('biblioserver')->{ccl2rpn}) { +# system("cp -f $kohadir/misc/zebra/ccl.properties ".C4::Context->zebraconfig('biblioserver')->{ccl2rpn}); + system("cp -f $kohadir/misc/zebra/ccl.properties $biblioserverdir/etc/ccl.properties"); print "Info: copied ccl.properties\n"; $created_dir_or_file++; } unless (-f C4::Context->zebraconfig('biblioserver')->{cql2rpn}) { - system("cp -f $kohadir/misc/zebra/pqf.properties ".C4::Context->zebraconfig('authorityserver')->{cql2rpn}); +# system("cp -f $kohadir/misc/zebra/pqf.properties ".C4::Context->zebraconfig('biblioserver')->{ccl2rpn}); + system("cp -f $kohadir/misc/zebra/pqf.properties $biblioserverdir/etc/pqf.properties"); print "Info: copied pqf.properties\n"; $created_dir_or_file++; } @@ -409,42 +412,42 @@ if ($biblios) { unless (-f C4::Context->zebraconfig('biblioserver')->{config}) { open ZD,">:utf8 ",C4::Context->zebraconfig('biblioserver')->{config}; print ZD " - # generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl - profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ - - encoding: UTF-8 - # Files that describe the attribute sets supported. - attset:bib1.att - attset:explain.att - attset:gils.att - - modulePath:$modulesdir/modules/ - # Specify record type - iso2709.recordType:grs.marcxml.record - recordType:grs.xml - recordId: (bib1,Local-Number) - storeKeys:1 - storeData:1 - - - # Lock File Area - lockDir: $biblioserverdir/lock - perm.anonymous:r - perm.kohaadmin:rw - passw.kohalis - shadow - register: $biblioserverdir/register:4G - shadow: $biblioserverdir/shadow:4G - - # Temp File area for result sets - setTmpDir: $biblioserverdir/tmp - - # Temp File area for index program - keyTmpDir: $biblioserverdir/key - - # Approx. Memory usage during indexing - memMax: 40M - rank:rank-1 +# generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl +profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ + +encoding: UTF-8 +# Files that describe the attribute sets supported. +attset:bib1.att +attset:explain.att +attset:gils.att + +modulePath:$modulesdir/modules/ +# Specify record type +iso2709.recordType:grs.marcxml.record +recordType:grs.xml +recordId: (bib1,Local-Number) +storeKeys:1 +storeData:1 + + +# Lock File Area +lockDir: $biblioserverdir/lock +perm.anonymous:r +perm.kohaadmin:rw +passw.kohalis +shadow +register: $biblioserverdir/register:4G +shadow: $biblioserverdir/shadow:4G + +# Temp File area for result sets +setTmpDir: $biblioserverdir/tmp + +# Temp File area for index program +keyTmpDir: $biblioserverdir/key + +# Approx. Memory usage during indexing +memMax: 40M +rank:rank-1 "; print "Info: creating zebra-biblios.cfg\n"; $created_dir_or_file++; @@ -478,7 +481,8 @@ if ($biblios) { my $i=0; while (my ($biblionumber) = $sth->fetchrow) { my $record = GetMarcBiblio($biblionumber); - # warn $record->as_formatted; + warn $record->as_formatted; +die if $record->subfield('090','9') eq 11; # print $record; # check that biblionumber & biblioitemnumber are stored in the MARC record, otherwise, add them & update the biblioitems.marcxml data. my $record_correct=1; @@ -554,6 +558,7 @@ if ($biblios) { print "====================\n"; print "REINDEXING zebra\n"; print "====================\n"; +warn ">>>>>>>>>>>>>".C4::Context->zebraconfig('biblioserver')->{config}; 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}." -d biblios commit");