3 # Copyright 2000-2006 Katipo Communications
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
30 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
32 # set the version for version checking
33 $VERSION = do { my @v = '$Revision$' =~ /\d+/g;
34 shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
38 C4::Search - Functions for searching the Koha catalog and other databases
46 This module provides the searching facilities for the Koha catalog and
57 # make all your functions, whether exported or not;
60 my ($search,$type)=@_;
61 my $dbh=C4::Context->dbh();
66 $Zconn = new ZOOM::Connection(C4::Context->config("zebradb"));
69 warn "Error ", $@->code(), ": ", $@->message(), "\n";
74 foreach my $var (keys %$search) {
75 $string.="$var=\"$search->{$var}\" ";
77 $Zconn->option(cqlfile => C4::Context->config("intranetdir")."/zebra/pqf.properties");
78 $Zconn->option(preferredRecordSyntax => "usmarc");
79 $q = new ZOOM::Query::CQL2RPN( $string, $Zconn);
82 my $rs = $Zconn->search($q);
85 $raw=$rs->record(0)->raw();
88 # $raw=$rs->record(0)->raw();
94 print "Error ", $@->code(), ": ", $@->message(), "\n";
96 my $record = MARC::Record->new_from_usmarc($raw);
98 # transform it into a meaningul hash
99 my $line = MARCmarc2koha($dbh,$record);
101 my $biblionumber=$line->{biblionumber};
102 my $title=$line->{title};
113 Koha Developement team <info@koha.org>