Permalink
Browse files

FRBR: configure PazPar2 during installation

Also added koha-pazpar2-ctl.sh to start and stop
PazPar2.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
  • Loading branch information...
1 parent 94f32e2 commit 70dccacee53693493235e81cb34dde8fe57ad4a2 Galen Charlton committed with Joshua Ferraro Feb 11, 2008
Showing with 113 additions and 6 deletions.
  1. +1 −1 C4/Search.pm
  2. +60 −1 Makefile.PL
  3. +12 −0 etc/koha-conf.xml
  4. +2 −2 etc/pazpar2/koha-biblios.xml
  5. +2 −2 etc/pazpar2/pazpar2.xml
  6. +31 −0 misc/bin/koha-pazpar2-ctl.sh
  7. +5 −0 rewrite-config.PL
View
@@ -620,7 +620,7 @@ sub pazGetRecords {
$query_type, $scan
) = @_;
- my $paz = C4::Search::PazPar2->new('http://localhost:10006/search.pz2');
+ my $paz = C4::Search::PazPar2->new(C4::Context->config('pazpar2url'));
$paz->init();
$paz->search($simple_query);
sleep 1;
View
@@ -201,6 +201,10 @@ command-line, e.g., READMEs.
Directory for Apache and Zebra logs produced by Koha.
+=item PAZPAR2_CONF_DIR
+
+Directory for PazPar2 configuration files.
+
=item NONE
This is a dummy target used to explicitly state
@@ -230,6 +234,7 @@ my $target_map = {
'./edithelp.pl' => 'INTRANET_CGI_DIR',
'./etc' => { target => 'KOHA_CONF_DIR', trimdir => -1 },
'./etc/zebradb' => { target => 'ZEBRA_CONF_DIR', trimdir => -1 },
+ './etc/pazpar2' => { target => 'PAZPAR2_CONF_DIR', trimdir => -1 },
'./help.pl' => 'INTRANET_CGI_DIR',
'./installer-CPAN.pl' => 'NONE',
'./installer' => 'INTRANET_CGI_DIR',
@@ -370,6 +375,7 @@ my %config_defaults = (
'DB_PASS' => 'katikoan',
'INSTALL_ZEBRA' => 'yes',
'INSTALL_SRU' => 'yes',
+ 'INSTALL_PAZPAR2' => 'no',
'AUTH_INDEX_MODE' => 'grs1',
'ZEBRA_MARC_FORMAT' => 'marc21',
'ZEBRA_LANGUAGE' => 'en',
@@ -380,6 +386,10 @@ my %config_defaults = (
'ZEBRA_SRU_AUTHORITIES_PORT' => '9999',
'KOHA_USER' => 'koha',
'KOHA_GROUP' => 'koha',
+ 'MERGE_SERVER_HOST' => 'localhost',
+ 'MERGE_SERVER_PORT' => '11001',
+ 'PAZPAR2_HOST' => 'localhost',
+ 'PAZPAR2_PORT' => '11002',
);
# set some default configuratio options based on OS
@@ -447,9 +457,16 @@ if ($config{'INSTALL_ZEBRA'} eq "yes") {
if ($config{'INSTALL_MODE'} ne 'dev') {
push @{ $pl_files->{'rewrite-config.PL'} }, (
'blib/SCRIPT_DIR/koha-zebra-ctl.sh',
+ 'blib/SCRIPT_DIR/koha-pazpar2-ctl.sh',
'blib/SCRIPT_DIR/koha-zebraqueue-ctl.sh',
);
}
+ if ($config{'INSTALL_PAZPAR2'} eq 'yes') {
+ push @{ $pl_files->{'rewrite-config.PL'} }, (
+ 'blib/PAZPAR2_CONF_DIR/koha-biblios.xml',
+ 'blib/PAZPAR2_CONF_DIR/pazpar2.xml'
+ );
+ }
$config{'ZEBRA_AUTH_CFG'} = $config{'AUTH_INDEX_MODE'} eq 'dom' ? 'zebra-authorities-dom.cfg' : 'zebra-authorities.cfg';
$config{'AUTH_RETRIEVAL_CFG'} =
$config{'AUTH_INDEX_MODE'} eq 'dom' ? 'retrieval-info-auth-dom.xml' : 'retrieval-info-auth-grs1.xml';
@@ -926,6 +943,41 @@ SRU port for authority data?);
$config{'ZEBRA_SRU_AUTHORITIES_PORT'} = _get_value('ZEBRA_SRU_AUTHORITIES_PORT', $msg, $defaults->{'ZEBRA_SRU_AUTHORITIES_PORT'}, $valid_values);
}
+
+ $msg = q(
+Since you've chosen to use Zebra, you can also choose to
+install PazPar2, which is a metasearch tool. With PazPar2,
+Koha can perform on-the-fly merging of bibliographic
+records during searching, allowing for FRBRization of
+the results list.
+
+Install the PazPar2 configuration files?);
+ $msg .= _add_valid_values_disp('INSTALL_PAZPAR2', $valid_values);
+ $config{'INSTALL_PAZPAR2'} = _get_value('INSTALL_PAZPAR2', $msg, $defaults->{'INSTALL_PAZPAR2'}, $valid_values);
+
+ if ($config{'INSTALL_PAZPAR2'} eq 'yes') {
+ $msg = q(
+Since you've chosen to configure PazPar2, you must
+specify the host and port(s) that PazPar2
+uses:
+);
+ $msg = q(
+Zebra bibliographic server host?);
+ $config{'MERGE_SERVER_HOST'} = _get_value('MERGE_SERVER_HOST', $msg, $defaults->{'MERGE_SERVER_HOST'}, $valid_values);
+
+ $msg = q(
+Zebra bibliographic port for PazPar2 to use?);
+ $config{'MERGE_SERVER_PORT'} = _get_value('MERGE_SERVER_PORT', $msg, $defaults->{'MERGE_SERVER_PORT'}, $valid_values);
+
+ $msg = q(
+PazPar2 host?);
+ $config{'PAZPAR2_HOST'} = _get_value('PAZPAR2_HOST', $msg, $defaults->{'PAZPAR2_HOST'}, $valid_values);
+
+ $msg = q(
+PazPar2 port?);
+ $config{'PAZPAR2_PORT'} = _get_value('PAZPAR2_PORT', $msg, $defaults->{'PAZPAR2_PORT'}, $valid_values);
+
+ }
}
print "\n\n";
@@ -1010,6 +1062,7 @@ sub get_target_directories {
$dirmap{'PERL_MODULE_DIR'} = File::Spec->catdir(@basedir, $package, 'lib');
$dirmap{'KOHA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc');
$dirmap{'ZEBRA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'zebradb');
+ $dirmap{'PAZPAR2_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'pazpar2');
$dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
$dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
$dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
@@ -1036,6 +1089,7 @@ sub get_target_directories {
$skipdirs{'PERL_MODULE_DIR'} = 1;
$dirmap{'KOHA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc');
$dirmap{'ZEBRA_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'zebradb');
+ $dirmap{'PAZPAR2_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'pazpar2');
$dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
$dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
$skipdirs{'SCRIPT_DIR'} = 1;
@@ -1056,6 +1110,7 @@ sub get_target_directories {
$dirmap{'PERL_MODULE_DIR'} = File::Spec->catdir(@basedir, $package, 'lib');
$dirmap{'KOHA_CONF_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'etc', $package);
$dirmap{'ZEBRA_CONF_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'etc', $package, 'zebradb');
+ $dirmap{'PAZPAR2_CONF_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'etc', $package, 'pazpar2');
$dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
$dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
$dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
@@ -1240,8 +1295,12 @@ Zebra's configuration files.
sub _update_zebra_conf_target {
my $target = "\nupdate_zebra_conf ::\n";
- $target .= "\tumask 022; \$(MOD_INSTALL) \\\n";
+ $target .= "\tumask 022; \$(MOD_INSTALL) \\\n";
$target .= "\t\t\$(KOHA_INST_ZEBRA_CONF_DIR) \$(KOHA_DEST_ZEBRA_CONF_DIR) \n";
+ $target .= "\t\$(NOECHO) chmod -R u+w \$(KOHA_DEST_ZEBRA_CONF_DIR)\n" unless $^O eq "MSWin32";
+ $target .= "\tumask 022; \$(MOD_INSTALL) \\\n";
+ $target .= "\t\t\$(KOHA_INST_PAZPAR2_CONF_DIR) \$(KOHA_DEST_PAZPAR2_CONF_DIR) \n";
+ $target .= "\t\$(NOECHO) chmod -R u+w \$(KOHA_DEST_PAZPAR2_CONF_DIR)\n" unless $^O eq "MSWin32";
return $target;
}
View
@@ -9,6 +9,17 @@
<!-- public server runs on tcp -->
<!-- <listen id="publicserver" >tcp:@:9999</listen> -->
+<!-- Settings for special biblio server instance for PazPar2.
+ Because PazPar2 only connects to a Z39.50 server using TCP/IP,
+ it cannot use the Unix-domain socket that biblioserver uses.
+ Therefore, a custom server is defined. -->
+<listen id="mergeserver">tcp:@:__MERGE_SERVER_PORT__</listen>
+<server id="mergeserver" listenref="mergeserver">
+ <directory>__ZEBRA_DATA_DIR__/biblios</directory>
+ <config>__ZEBRA_CONF_DIR__/zebra-biblios.cfg</config>
+ <cql2rpn>__ZEBRA_CONF_DIR__/pqf.properties</cql2rpn>
+</server>
+
<!-- BIBLIOGRAPHIC RECORDS -->
<server id="biblioserver" listenref="biblioserver">
<directory>__ZEBRA_DATA_DIR__/biblios</directory>
@@ -173,5 +184,6 @@
<intrahtdocs>__INTRANET_TMPL_DIR__</intrahtdocs>
<includes>__INTRANET_TMPL_DIR__/prog/en/includes/</includes>
<logdir>__LOG_DIR__</logdir>
+ <pazpar2url>http://__PAZPAR2_HOST__:__PAZPAR2_PORT__/search.pz2</pazpar2url>
</config>
</yazgfs>
@@ -1,4 +1,4 @@
-<settings target="localhost:10005/biblios">
+<settings target="__MERGE_SERVER_HOST__:__MERGE_SERVER_PORT__/biblios">
<set name="pz:name" value="Koha bib database"/>
@@ -25,6 +25,6 @@
<!-- Result normalization settings -->
<set name="pz:nativesyntax" value="iso2709"/>
- <set name="pz:xslt" value="marc21-work-groups.xsl"/>
+ <set name="pz:xslt" value="__ZEBRA_MARC_FORMAT__-work-groups.xsl"/>
</settings>
View
@@ -3,8 +3,8 @@
<pazpar2 xmlns="http://www.indexdata.com/pazpar2/1.0">
<server>
- <listen port="10006"/>
- <settings src="/home/gmc/koha/dev/etc/pazpar2/koha-biblios.xml"/>
+ <listen port="__PAZPAR2_PORT__"/>
+ <settings src="__PAZPAR2_CONF_DIR__/koha-biblios.xml"/>
<relevance>
<icu_chain id="relevance" locale="el">
@@ -0,0 +1,31 @@
+#!/bin/bash
+USER=__KOHA_USER__
+GROUP=__KOHA_GROUP__
+NAME=koha-pazpar2-ctl
+LOGDIR=__LOG_DIR__
+ERRLOG=$LOGDIR/koha-pazpar2daemon.err
+STDOUT=$LOGDIR/koha-pazpar2daemon.log
+OUTPUT=$LOGDIR/koha-pazpar2daemon-output.log
+PAZPAR2_CONF=__PAZPAR_CONF_DIR__/pazpar2.xml
+PAZPAR2SRV=/usr/sbin/pazpar2
+
+test -f $PAZPAR2SRV || exit 0
+
+case "$1" in
+ start)
+ echo "Starting PazPar2 Server"
+ daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --user=$USER.$GROUP -- $PAZPAR2SRV -f $PAZPAR2_CONF
+ ;;
+ stop)
+ echo "Stopping PazPar2 Server"
+ daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --user=$USER.$GROUP --stop -- $PAZPAR2SRV -f $PAZPAR2_CONF
+ ;;
+ restart)
+ echo "Restarting the PazPar2 Server"
+ daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --user=$USER.$GROUP --restart -- $PAZPAR2SRV -f $PAZPAR2_CONF
+ ;;
+ *)
+ echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
+ exit 1
+ ;;
+esac
View
@@ -100,6 +100,7 @@ $prefix = $ENV{'INSTALL_BASE'} || "/usr";
'__PERL_MODULE_DIR__' => ($ENV{'INSTALLSITELIB'} || sprintf($prefix."/lib/perl5/site_perl/%vd",$^V))."/koha",
'__KOHA_CONF_DIR__' => "$prefix/etc/koha",
'__ZEBRA_CONF_DIR__' => "$prefix/etc/koha/zebradb",
+ '__PAZPAR2_CONF_DIR__' => "$prefix/etc/koha/pazpar2",
'__MISC_DIR__' => "$prefix/misc",
'__SCRIPT_DIR__' => "$prefix/bin",
'__MAN_DIR__' => "$prefix/man",
@@ -111,6 +112,10 @@ $prefix = $ENV{'INSTALL_BASE'} || "/usr";
'__ZEBRA_LANGUAGE__' => 'en',
'__ZEBRA_AUTH_CFG__' => 'zebra-authorities.cfg',
'__AUTH_RETRIEVAL_CFG__' => 'retrieval-info-auth-grs1.xml',
+ "__MERGE_SERVER_HOST__" => $myhost,
+ "__MERGE_SERVER_PORT__" => '11001',
+ "__PAZPAR2_HOST__" => $myhost,
+ "__PAZPAR2_PORT__" => '11002',
);
# Override configuration from the environment

0 comments on commit 70dccac

Please sign in to comment.