koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/misc/migration_tools rebuild_zebra.pl,NONE,1.1


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/misc/migration_tools rebuild_zebra.pl,NONE,1.1
Date: Thu, 11 Aug 2005 09:35:57 -0700

Update of /cvsroot/koha/koha/misc/migration_tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5186/misc/migration_tools

Added Files:
        rebuild_zebra.pl 
Log Message:
This script can be use to rebuild the zebra DB. It stores all koha MARC records 
in iso2709, in the bilbios directory. After that, you just have to "zebraidx 
update biblios"

I tried on a 9900 DB, here are the results :

address@hidden migration_tools]$ ./rebuild_zebra.pl -c
9900
9903 MARC record done in 37.9104120731354 seconds

address@hidden zebra]$ zebraidx update biblios
<snip>
18:31:24-11/08 zebraidx(20348) [log] Iterations . . . 144575
18:31:24-11/08 zebraidx(20348) [log] Distinct words .  39891
18:31:24-11/08 zebraidx(20348) [log] Updates. . . . .     46
18:31:24-11/08 zebraidx(20348) [log] Deletions. . . .      2
18:31:24-11/08 zebraidx(20348) [log] Insertions . . .  39843
18:31:24-11/08 zebraidx(20348) [log] zebra_register_close p=0x8104cf8
18:31:25-11/08 zebraidx(20348) [log] Records:    9887 i/u/d 9881/6/0
18:31:25-11/08 zebraidx(20348) [log] user/system: 531/145
18:31:25-11/08 zebraidx(20348) [log] zebra_stop
18:31:25-11/08 zebraidx(20348) [log] zebraidx times: 11.33  5.31  1.45


--- NEW FILE ---
#!/usr/bin/perl
# small script that import an iso2709 file into koha 2.0

use strict;

# Koha modules used
use MARC::File::USMARC;
use MARC::Record;
use MARC::Batch;
use C4::Context;
use C4::Biblio;
use Time::HiRes qw(gettimeofday);

use Getopt::Long;
my ( $input_marc_file, $number) = ('',0);
my ($confirm);
GetOptions(
    'c' => \$confirm,
);

unless ($confirm) {
        print <<EOF

script to write files for zebra DB reindexing. Once it's done, run zebraidx 
update biblios

run the script with -c to confirm the reindexing.

EOF
;#'
die;
}

$|=1; # flushes output

my $dbh = C4::Context->dbh;
my $cgidir = C4::Context->intranetdir ."/cgi-bin";
unless (opendir(DIR, "$cgidir")) {
                $cgidir = C4::Context->intranetdir."/";
} 

my $starttime = gettimeofday;
my $sth = $dbh->prepare("select biblionumber from biblio");
$sth->execute;
my $i=0;
while ((my $biblionumber) = $sth->fetchrow) {
        my $record = MARCgetbiblio($dbh,$biblionumber);
        my $filename = $cgidir."/zebra/biblios/BIBLIO".$biblionumber."iso2709";
        open F,"> $filename";
        print F $record->as_usmarc();
        close F;
        $i++;
        print "\r$i" unless ($i % 100);
}
my $timeneeded = gettimeofday - $starttime;
print "\n$i MARC record done in $timeneeded seconds\n";




reply via email to

[Prev in Thread] Current Thread [Next in Thread]