(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
This commit is contained in:
parent
e16ded6012
commit
b69a6736cb
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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++) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue