koha-zebra
[Top][All Lists]
Advanced

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

[Koha-zebra] zebra extended services problem


From: Paul POULAIN
Subject: [Koha-zebra] zebra extended services problem
Date: Tue, 03 Jan 2006 14:45:51 +0100
User-agent: Mozilla Thunderbird 1.0.6-7.1.20060mdk (X11/20050322)

Hi,

I begin to play with ZOOM::package and get some unclear (to me) errors...

Here is my perl code, that will build the zebra DB from the Koha DB (once it will work ;-) ) :
my $dbh = C4::Context->dbh;
my $Zconn;
eval {
        $Zconn = new ZOOM::Connection('localhost','2100');
};
if ($@) {
        print "Error ", address@hidden>code()," : 
",address@hidden>message();"\n";
}

# first, drop Zebra DB
eval {
my $Zpackage = $Zconn->package();
        $Zpackage->send("drop");
};
if ($@) {
        print "Error dropping /CODE:", address@hidden>code()," /MSG: 
",address@hidden>message();"\n";
}
# then recreate it
eval {
        my $Zpackage = $Zconn->package();
        $Zpackage->option(databaseName => 'Koha');
        $Zpackage->send("create");
};
if ($@) {
        print "Error creating /CODE:", address@hidden>code()," 
/MSG:",address@hidden>message();"\n\n";
}

my $cgidir = C4::Context->intranetdir ."/cgi-bin";
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 $Zpackage = $Zconn->package();
        $Zpackage->option(action => "recordInsert");
        $Zpackage->option(record => $record->as_usmarc);
        eval {
                $Zpackage->send("update");
        };
        if ($@) {
        print "Error updating ", address@hidden>code()," => 
",address@hidden>message(),"\n";
        }
        $Zpackage->destroy;
        $i++;
        print "\r$i" unless ($i % 100);
}
my $timeneeded = gettimeofday - $starttime;

At 1st, this the drop/create database did not work.
I added perm.anonymous: rw
in zebra.cfg and it's OK

But now, I get a :
Error updating 10002 => Encoding failed

I bet it's
>    $Zpackage->option(record => $record->as_usmarc);
that is not the correct option, but I don't know how code the MARC record and transmit it to zebra !

Thanks for your directions.
--
Paul POULAIN
Consultant indépendant en logiciels libres
responsable francophone de koha (SIGB libre http://www.koha-fr.org)




reply via email to

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