[Koha-zebra] zebra extended services problem

Mike Taylor mike at miketaylor.org.uk
Thu Jan 5 12:17:18 CET 2006


> Date: Tue, 03 Jan 2006 14:45:51 +0100
> From: Paul POULAIN <paul.poulain at free.fr>
> 
> I begin to play with ZOOM::package and get some unclear (to me)
> errors...

Hi, Paul, thanks for this message, let's see what we can clear up.

>> eval {
>> 	$Zconn = new ZOOM::Connection('localhost','2100');
>> };
>> if ($@) {
>> 	print "Error ", $@->code()," : ",$@->message();"\n";
>> }

First of all, you may find it useful to know that you can omit these
explicit error-checks, at least for one-off command-line programs:
Perl's default behaviour when an object is thrown (i.e. used as the
argument to die()) is just to print it, and the ZOOM::Exception class
renders itself quite nicely.  Of course, you'll still need to catch
exceptions if you want to handle them intelligently, but if all you're
doing it printing them, then there's no need.

>> # first, drop Zebra DB
>> eval {
>> my $Zpackage = $Zconn->package();
>> 	$Zpackage->send("drop");
>> };

Two problems here.  First, _what_ database do you want to drop?  You
need to set its name into the XS package so that the server knows what
you're requesting:
	$Zpackage->option(databaseName => $dbname);

Second, there is a known bug in the database-dropping code that
corrupts the registers:
	http://bugzilla.indexdata.dk/show_bug.cgi?id=447
so please don't do that for now!  (I know it's lame; it'll get fixed.)

>> eval {
>> 	my $Zpackage = $Zconn->package();
>> 	$Zpackage->option(databaseName => 'Koha');
>> 	$Zpackage->send("create");
>> };

That looks fine.

>> 	$Zpackage->option(record => $record->as_usmarc);
> [...]
> But now, I get a :
> Error updating 10002 => Encoding failed
> 
> I bet it's
>  > 	$Zpackage->option(record => $record->as_usmarc);

Once more, you win the prize!  (Three in 24 hours.  Good going.)

You're correct, the problem is in the form of the record you're
passing into Zebra.  I am sorry that it's not diagnosed more
explicitly.

> that is not the correct option, but I don't know how code the MARC
> record and transmit it to zebra !

Zebra update works with XML, so you'll need to translate the MARC
record into MARCXML and send that.  (Seb, I don't know whether more
configuration is required on the server side to let it understand
what's happening?)

 _/|_	 ___________________________________________________________________
/o ) \/  Mike Taylor  <mike at miketaylor.org.uk>  http://www.miketaylor.org.uk
)_v__/\  Peer review is a lot like the USA.  The current implementation
	 sucks, but the idea is still good and noble and worth fighting
	 for.  And even the current implementation is way better than
	 most of the alternatives.







More information about the Koha-zebra mailing list