From b69a6736cba0c47d5841bcaf1b990f208e8fe731 Mon Sep 17 00:00:00 2001 From: tipaul Date: Tue, 14 Feb 2006 11:23:38 +0000 Subject: [PATCH] (chris, read carefully) Replacing zebraserver and zebraport by zebradb in koha.conf . The zebra connexion can be done in a single variable "server:port/database". I used this in dirty searchMarc.pm as well as in Biblio.pm. I've replaced your code in Search.pm --- C4/Search.pm | 8 ++------ C4/SearchMarc.pm | 9 +++------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 86b723db1b..1413a5dd19 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -60,14 +60,10 @@ sub search { my ($search,$type)=@_; my $dbh=C4::Context->dbh(); my $q; - my $host=C4::Context->config("zebraserver"); - my $port=C4::Context->config("zebraport"); - my $intranetdir=C4::Context->config("intranetdir"); - my $database="koha3"; my $Zconn; my $raw; eval { - $Zconn = new ZOOM::Connection("$host:$port/$database"); + $Zconn = new ZOOM::Connection(C4::Context->config("zebradb")); }; if ($@) { warn "Error ", $@->code(), ": ", $@->message(), "\n"; @@ -78,7 +74,7 @@ sub search { foreach my $var (keys %$search) { $string.="$var=\"$search->{$var}\" "; } - $Zconn->option(cqlfile => "$intranetdir/zebra/pqf.properties"); + $Zconn->option(cqlfile => C4::Context->config("intranetdir")."/zebra/pqf.properties"); $Zconn->option(preferredRecordSyntax => "usmarc"); $q = new ZOOM::Query::CQL2RPN( $string, $Zconn); } diff --git a/C4/SearchMarc.pm b/C4/SearchMarc.pm index 941aecf165..143ff7f3c6 100644 --- a/C4/SearchMarc.pm +++ b/C4/SearchMarc.pm @@ -237,15 +237,12 @@ sub catalogsearch { warn "QUERY : $query"; my $Zconn; eval { - $Zconn = new ZOOM::Connection('localhost:2100/koha3'); + $Zconn = new ZOOM::Connection(C4::Context->config("zebradb")); }; - warn "ICI"; - $Zconn->option(cqlfile => "/usr/local/koha3/intranet/zebra/pqf.properties"); + $Zconn->option(cqlfile => C4::Context->config("intranetdir")."/zebra/pqf.properties"); $Zconn->option(preferredRecordSyntax => "xml"); - warn "LA"; my $q = new ZOOM::Query::CQL2RPN( $query, $Zconn); # warn "ERROR : ".$Zconn->errcode(); - warn "Q : $q"; my $rs = $Zconn->search($q); my $numresults=$rs->size(); if ($numresults eq 0) { @@ -258,7 +255,7 @@ sub catalogsearch { my @finalresult = (); my @CNresults=(); my $totalitems=0; - $offset=0 unless $offset; + $offset=1 unless $offset; # calculate max offset my $maxrecordnum = $offset+$length<$numresults?$offset+$length:($numresults); for (my $i=$offset-1; $i <= $maxrecordnum-1; $i++) { -- 2.39.5