[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/C4 Biblio.pm,1.127,1.128
From: |
Paul POULAIN |
Subject: |
[Koha-cvs] CVS: koha/C4 Biblio.pm,1.127,1.128 |
Date: |
Thu, 11 Aug 2005 09:12:49 -0700 |
Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32515/C4
Modified Files:
Biblio.pm
Log Message:
Playing with the zebra...
* go to koha cvs home directory
* in misc/zebra there is a unimarc directory. I suggest that marc21 libraries
create a marc21 directory
* put your zebra.cfg files here & create your database.
* from koha cvs home directory, ln -s misc/zebra/marc21 zebra (I mean create a
symbolic link to YOUR zebra directory)
* now, everytime you add/modify a biblio/item your zebra DB is updated
correctly.
NOTE :
* this uses a system call in perl. CPU consumming, but we are waiting for
indexdata Perl/zoom
* deletion still not work
* UNIMARC zebra config files are provided in misc/zebra/unimarc directory. The
most important line being :
in zebra.cfg :
recordId: (bib1,Local-number)
storeKeys:1
in .abs file :
elm 090 Local-number -
elm 090/? Local-number -
elm 090/?/9 Local-number !:w
(090$9 being the field mapped to biblio.biblionumber in Koha)
Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.127
retrieving revision 1.128
diff -C2 -r1.127 -r1.128
*** Biblio.pm 11 Aug 2005 14:37:32 -0000 1.127
--- Biblio.pm 11 Aug 2005 16:12:47 -0000 1.128
***************
*** 133,136 ****
--- 133,152 ----
=cut
+ sub zebra_create {
+ my ($biblionumber,$record) = @_;
+ # create the iso2709 file for zebra
+ my $cgidir = C4::Context->intranetdir ."/cgi-bin";
+ unless (opendir(DIR, "$cgidir")) {
+ $cgidir = C4::Context->intranetdir."/";
+ }
+
+ my $filename = $cgidir."/zebra/biblios/BIBLIO".$biblionumber."iso2709";
+ open F,"> $filename";
+ print F $record->as_usmarc();
+ close F;
+ my $res = system("cd $cgidir/zebra;/usr/local/bin/zebraidx update
biblios");
+ unlink($filename);
+ warn "$biblionumber : $res";
+ }
=head2 @tagslib = &MARCgettagslib($dbh,1|0,$frameworkcode);
***************
*** 780,784 ****
REALmodbiblio($dbh,$oldbiblio);
! REALmodbiblitem($dbh,$oldbiblio);
# now, modify addi authors, subject, addititles.
my ($tagfield,$tagsubfield) =
MARCfind_marc_from_kohafield($dbh,"additionalauthors.author",$frameworkcode);
--- 796,800 ----
REALmodbiblio($dbh,$oldbiblio);
! REALmodbiblioitem($dbh,$oldbiblio);
# now, modify addi authors, subject, addititles.
my ($tagfield,$tagsubfield) =
MARCfind_marc_from_kohafield($dbh,"additionalauthors.author",$frameworkcode);
***************
*** 1103,1107 ****
} # sub modsubject
! =head2 REALmodbiblitem($dbh, $biblioitem);
=over 4
--- 1119,1123 ----
} # sub modsubject
! =head2 REALmodbiblioitem($dbh, $biblioitem);
=over 4
***************
*** 1112,1116 ****
=cut
! sub REALmodbiblitem {
my ( $dbh, $biblioitem ) = @_;
my $query;
--- 1128,1132 ----
=cut
! sub REALmodbiblioitem {
my ( $dbh, $biblioitem ) = @_;
my $query;
***************
*** 1127,1130 ****
--- 1143,1148 ----
$biblioitem->{bnotes},
$biblioitem->{size}, $biblioitem->{place}, $biblioitem->{marc},
$biblioitem->{marcxml},
$biblioitem->{biblioitemnumber});
+ my $record = MARC::File::USMARC::decode($biblioitem->{marc});
+ zebra_create($biblioitem->{biblionumber}, $record);
# warn "MOD : $biblioitem->{biblioitemnumber} = ".$biblioitem->{marc};
} # sub modbibitem
***************
*** 1190,1193 ****
--- 1208,1212 ----
);
$dbh->do("unlock tables");
+ zebra_create($biblioitem->{biblionumber}, $record);
return ($biblioitemnumber);
}
***************
*** 1330,1333 ****
--- 1349,1353 ----
$error .= $sth->errstr;
}
+ zebra_create($item->{biblionumber},$record);
$dbh->do('unlock tables');
return ( $itemnumber, $error );
***************
*** 1416,1419 ****
--- 1436,1440 ----
$sth=$dbh->prepare("update biblioitems set marc=?,marcxml=? where
biblionumber=? and biblioitemnumber=?");
$sth->execute($record->as_usmarc(),$record->as_xml(),$item->{biblionumber},$item->{biblioitemnumber});
+ zebra_create($item->biblionumber,$record);
if ( defined $sth->errstr ) {
$error .= $sth->errstr;
***************
*** 1723,1727 ****
my ($biblioitem) = @_;
my $dbh = C4::Context->dbh;
! &REALmodbiblitem( $dbh, $biblioitem );
} # sub modbibitem
--- 1744,1748 ----
my ($biblioitem) = @_;
my $dbh = C4::Context->dbh;
! &REALmodbiblioitem( $dbh, $biblioitem );
} # sub modbibitem
***************
*** 2322,2325 ****
--- 2343,2370 ----
# $Id$
# $Log$
+ # Revision 1.128 2005/08/11 16:12:47 tipaul
+ # Playing with the zebra...
+ #
+ # * go to koha cvs home directory
+ # * in misc/zebra there is a unimarc directory. I suggest that marc21
libraries create a marc21 directory
+ # * put your zebra.cfg files here & create your database.
+ # * from koha cvs home directory, ln -s misc/zebra/marc21 zebra (I mean
create a symbolic link to YOUR zebra directory)
+ # * now, everytime you add/modify a biblio/item your zebra DB is updated
correctly.
+ #
+ # NOTE :
+ # * this uses a system call in perl. CPU consumming, but we are waiting for
indexdata Perl/zoom
+ # * deletion still not work
+ # * UNIMARC zebra config files are provided in misc/zebra/unimarc directory.
The most important line being :
+ # in zebra.cfg :
+ # recordId: (bib1,Local-number)
+ # storeKeys:1
+ #
+ # in .abs file :
+ # elm 090 Local-number -
+ # elm 090/? Local-number -
+ # elm 090/?/9 Local-number !:w
+ #
+ # (090$9 being the field mapped to biblio.biblionumber in Koha)
+ #
# Revision 1.127 2005/08/11 14:37:32 tipaul
# * POD documenting
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/C4 Biblio.pm,1.127,1.128,
Paul POULAIN <=
- Prev by Date:
[Koha-cvs] CVS: koha/C4 Biblio.pm,1.126,1.127
- Next by Date:
[Koha-cvs] CVS: koha/misc/zebra/unimarc unimarc.abs,1.1,1.2 zebra.cfg,1.1,1.2
- Previous by thread:
[Koha-cvs] CVS: koha/C4 Biblio.pm,1.126,1.127
- Next by thread:
[Koha-cvs] CVS: koha/misc/zebra/unimarc unimarc.abs,1.1,1.2 zebra.cfg,1.1,1.2
- Index(es):