koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha C4/Search.pm koha-tmpl/opac-tmpl/prog/en/o... [rel_3_0]


From: Antoine Farnault
Subject: [Koha-cvs] koha C4/Search.pm koha-tmpl/opac-tmpl/prog/en/o... [rel_3_0]
Date: Fri, 06 Oct 2006 13:36:36 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Antoine Farnault <toins>        06/10/06 13:36:36

Modified files:
        C4             : Search.pm 
        koha-tmpl/opac-tmpl/prog/en: opac-results.tmpl 
        opac           : opac-search.pl 

Log message:
        Synch with dev_week.
        Search.pm has the new search API now.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Search.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.120.2.5&r2=1.120.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/prog/en/opac-results.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.1&r2=1.1.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-search.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.38.2.1&r2=1.38.2.2

Patches:
Index: C4/Search.pm
===================================================================
RCS file: /sources/koha/koha/C4/Search.pm,v
retrieving revision 1.120.2.5
retrieving revision 1.120.2.6
diff -u -b -r1.120.2.5 -r1.120.2.6
--- C4/Search.pm        26 Sep 2006 16:16:08 -0000      1.120.2.5
+++ C4/Search.pm        6 Oct 2006 13:36:36 -0000       1.120.2.6
@@ -32,6 +32,8 @@
 
 use Lingua::Stem;
        
+use Data::Dumper; # only for developpement.
+
        # FIXME - C4::Search uses C4::Reserves2, which uses C4::Search.
        # So Perl complains that all of the functions here get redefined.
 #use C4::Date;
@@ -39,7 +41,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.120.2.5 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.120.2.6 $' =~ /\d+/g;
           shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 =head1 NAME
@@ -243,10 +245,9 @@
     $startfrom = $offset; # offset
     my $ccl_query;
     for (my $i = 0 ; $i <= $#{$value} ; $i++) {
-        $ccl_query= ($ccl_query?'@'address@hidden:"").' @attr 
1='address@hidden" "address@hidden if (@$value[$i]);
+        $ccl_query.= @$value[$i];
     }
-    warn "ccl_query :".$ccl_query;
-    my ($error,$count,$facets,@results) = 
searchZOOM('search','rpn',$ccl_query,$number_of_results,$startfrom,$then_sort_by);
+    my ($error,$count,$facets,@results) = 
searchZOOM('search','ccl',$ccl_query,$number_of_results,$startfrom,$then_sort_by);
 
     my @result = ();
     my $subtitle; # Added by JF for Subtitles
@@ -255,7 +256,7 @@
     #put them in @result
     foreach my $rec (@results) {
         my $record = MARC::Record->new_from_usmarc($rec);
-        warn "record :=".$record->as_formatted;
+        #warn "record :=".$record->as_formatted;
         my $oldbiblio = MARCmarc2koha($dbh,$record,'');
         push @result, $oldbiblio->{'biblionumber'}; #FIXME bibid?
     }
@@ -435,24 +436,20 @@
        my  $type;
        my ($biblionumber,$bibid,$title);
        # search duplicate on ISBN, easy and fast..
-$search->{'avoidquerylog'}=1;
+       #$search->{'avoidquerylog'}=1;
        if ($result->{isbn}) {
-       $type="precise";
-###Temporary fix for ISBN
-my $isbn=$result->{isbn};
-$isbn=~ s/(\.|\?|\;|\=|\/|\\|\||\:|\!|\'|,|\-|\"|\(|\)|\[|\]|\{|\}|\/)//g;
-               $search->{'isbn'}=$isbn;
+               $query = "isbn=$result->{isbn}";
                        }else{
 $result->{title}=~s /\\//g;
 $result->{title}=~s /\"//g;
-       $type="loose";
-       $search->{'field_name1'}="title";
-       $search->{'field_value1'}=$result->{title};
-       $search->{'ttype1'}="exact";
-       $search->{'atype1'}="start";
+               $query = "ti,ext=$result->{title}";
+       }
+       my 
($possible_duplicate_record)=C4::Biblio::getRecord("biblioserver",$query,"usmarc");
+       if ($possible_duplicate_record) {
+               my $marcrecord = 
MARC::Record->new_from_usmarc($possible_duplicate_record);
+               my $result = MARCmarc2koha($dbh,$marcrecord,'');
+               return $result->{'biblionumber'}, 
$result->{'biblionumber'},$result->{'title'} if $result;
        }
-       my ($total,@result)=CatSearch($type,$result,1,0);
-       return $result[0]->{'biblionumber'}, 
$result[0]->{'biblionumber'},$result[0]->{'title'} if ($total);
 
 }
 =item KeywordSearch
@@ -1626,14 +1623,11 @@
     # gotten, the user might get a blank page. It would be much better
     # to at least print an error message. The easiest way to do this
     # is to set $SIG{__DIE__}.
-    my $sth   = $dbh->prepare("Select * from items where
-items.biblioitemnumber = ?")
-      || die $dbh->errstr;
+    my $sth = $dbh->prepare("Select * from items where items.biblioitemnumber 
= ?") || die $dbh->errstr;
     my $i     = 0;
     my @results;
 
-    $sth->execute($bibitem)
-      || die $sth->errstr;
+    $sth->execute($bibitem) || die $sth->errstr;
 
     while (my $data = $sth->fetchrow_hashref) {
         # Find out who currently has this item.
@@ -2648,7 +2642,6 @@
        # establish database connections
     my $dbh = C4::Context->dbh;
     my $zconn=C4::Context->Zconn("biblioserver");
-    warn "connected";
        my $branches = GetBranches();
        # make sure all is well with the connection
     if ($zconn eq "error") {
@@ -2659,7 +2652,6 @@
 
        # prepare the query depending on the type
     if ($type eq 'ccl') {
-        warn "query : $query";
                #$query =~ s/(\(|\))//g;
         eval {
                $koha_query_obj = new ZOOM::Query::CCL2RPN($query,$zconn);
@@ -2713,13 +2705,13 @@
        my $facets = [ {
                link_value => 'su',
                label_value => 'Subject - Topic',
-               tags => ['600', '610',],
+               tags => ['650', '651',],
                subfield => 'a',
                },
                {
         link_value => 'au',
         label_value => 'Authors',
-        tags => ['701','700',],
+        tags => ['100','700',],
         subfield => 'a',
                },
                {
@@ -2731,8 +2723,8 @@
                {
         link_value => 'branch',
         label_value => 'Branches',
-        tags => ['995',],
-        subfield => 'c',
+        tags => ['952',],
+        subfield => 'b',
                expanded => '1',
         },
        ];
@@ -2760,8 +2752,6 @@
         } else {
             my $rec = $result->record($i);
             push(@results,$rec->raw()) if $rec; #FIXME: sometimes this fails
-            my $tmprecord = MARC::Record->new_from_usmarc($rec->raw());
-            warn "rec$i :".$tmprecord->as_formatted;
                        
             ##### BUILD FACETS AND LIMITS ####
                        my $facet_record = 
MARC::Record->new_from_usmarc($rec->raw());
@@ -2806,7 +2796,7 @@
                                $facet_label_value = 
substr($one_facet,0,20)."..." unless length($facet_label_value)<=20;
                                # well, if it's a branch, label by the name, 
not the code
                                if ($link_value =~/branch/) {
-                                       warn "branch";
+                                       #warn "branch";
                                        $facet_label_value = 
$branches->{$one_facet}->{'branchname'};
                                }
                                
@@ -2840,7 +2830,6 @@
        return(undef,$numresults,address@hidden,@results);
 }
 
-
 # performs the search
 sub getRecords {
     my 
($koha_query,$federated_query,$sort_by_ref,$servers_ref,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan)
 = @_;
@@ -2860,29 +2849,23 @@
 
     #### INITIALIZE SOME VARS USED CREATE THE FACETED RESULTS
     my @facets_loop; # stores the ref to array of hashes for template
- 
+       #warn "Server are: ".Dumper(@servers);
     for (my $i = 0; $i < @servers; $i++) {
-               #warn "server: $servers[$i]";
-        $zconns[$i] = new ZOOM::Connection($servers[$i], 0,
-                                async => 1, # asynchronous mode
-                           #    count => 1, # piggyback retrieval count
-                                preferredRecordSyntax => "usmarc");
-        $zconns[$i]->option(    cclfile=> "/koha/etc/ccl.properties");
+        $zconns[$i] = C4::Context->Zconn($servers[$i],1);
+               
         # perform the search, create the results objects
                # if this is a local search, use the $koha-query, if it's a 
federated one, use the federated-query
                my $query_to_use;
-               if ($servers[$i] =~ /localhost/) {
+               if ($servers[$i] =~ /biblioserver/) {
                        $query_to_use = $koha_query;    
                } 
                else {
                        $query_to_use = $federated_query;
                }
-               #warn "query: $query_to_use";
                # check if we've got a query_type defined
                eval {
                if ($query_type) {
                        if ($query_type =~/^ccl/) {
-                               #$zconns[$i]->option(    cclqual=> 
C4::Context->preference("CCLProperties"));
                                $query_to_use =~ s/\:/\=/g; # change : to = 
last minute (FIXME)
                                $results[$i] = $zconns[$i]->search(new 
ZOOM::Query::CCL2RPN($query_to_use,$zconns[$i]));
                        }
@@ -2903,9 +2886,8 @@
                }
                };
                if ($@) {
-                       warn "prob ".$@;
+                       warn "prob with query $query_to_use ".$@;
                }
-               #warn "after query";
         # concatenate the sort_by limits and pass them to the results object
         my $sort_by;
         foreach my $sort (@sort_by) {
@@ -2916,11 +2898,8 @@
     }
     while ((my $i = ZOOM::event(address@hidden)) != 0) {
         my $ev = $zconns[$i-1]->last_event();
-        #warn ("connection ", $i-1, ": ", ZOOM::event_str($ev), ": 
$servers[$i-1]\n");
         if ($ev == ZOOM::Event::ZEND) {
-                       #warn "ended connection: $servers[$i-1]\n";
             my $size = $results[$i-1]->size();
-                       #warn "$size hits found\n";
             if ($size > 0) {
                 my $results_hash;
                 #$results_hash->{'server'} = $servers[$i-1];
@@ -2943,7 +2922,6 @@
                                # here we create a minimal MARC record and hand 
it off to the
                                # template just like a normal result ... 
perhaps not ideal, but
                                # it works for now FIXME: distinguish between 
MARC21 and UNIMARC
-        #                      use MARC::Record;
                                my $tmprecord = MARC::Record->new();
                                $tmprecord->encoding('UTF-8');
                                my $tmptitle = MARC::Field->new( '245',' ',' ',
@@ -2951,7 +2929,6 @@
                                b => $occ);
                                $tmprecord->append_fields($tmptitle);
                                                $results_hash->{'RECORDS'}[$j] 
= $tmprecord->as_usmarc();
-                                               #warn 
"SCAN:".$tmprecord->as_usmarc();
                 }
                                        else {
                                                $record = 
$results[$i-1]->record($j)->raw();
@@ -3122,7 +3099,7 @@
                                #$weighted_query .= " or any,ext,r4=$operand";  
       # index as exact 
                                $weighted_query .= " or kw,wrdl,r5=$operand";   
      # index as exact 
                                                        $weighted_query .= " or 
wrd,fuzzy,r9=$operand";
-                                                       #$weighted_query .= " 
or wrd=$stemmed_operand" if $stemming;
+                                                       $weighted_query .= " or 
wrd=$stemmed_operand" if $stemming;
                                                }
                                        }
                                        elsif ($index =~ /au/) {
@@ -3197,7 +3174,7 @@
                # FIXME: not quite right yet ... will work on this soon -- JF
                if ($limit =~ /available/) {
                        $limit_query.=" and (($query and datedue=0000-00-00) or 
($query and datedue=0000-00-00 not lost=1) or ($query and datedue=0000-00-00 
not lost=2))";
-                       $limit_search_desc.=" and available";
+                       #$limit_search_desc.=" and available";
                }
                elsif (($limit_query) && ($limit =~/mc/)) {
                        $limit_query.=" or $limit" if $limit;
@@ -3232,7 +3209,7 @@
        #warn "SEARCHDESC:".$human_search_desc;
        #warn "FEDERATED QUERY:".$federated_query;
     return (undef,$human_search_desc,$koha_query,$federated_query);
-    }
+}
 
 # IMO this subroutine is pretty messy still -- it's responsible for
 # building the HTML output for the template
@@ -3270,16 +3247,19 @@
         $subfieldstosearch{$column}=$tagsubfield;
     }
        my $times;
+       
        if ($offset+$results_per_page<=$hits) {
                $times= $offset+$results_per_page;
        } else {
                $times = $hits;
     }
+    
     for ( my $i=$offset; $i<$times; $i++){
         my $marcrecord;
         $marcrecord = MARC::File::USMARC::decode($marcresults[$i]);
-               #warn "RECORD".$marcresults[$i];
+       
         my $oldbiblio = MARCmarc2koha($dbh,$marcrecord,'');
+        
                # add spans to search term in results
                foreach my $term (@span_terms) {
                        my $old_term = $term;
@@ -3347,8 +3327,9 @@
                $oldbiblio->{wthdrawncount} = $wthdrawn_count;
                $oldbiblio->{itemlostcount} = $itemlost_count;
 
-=head
-# Ugh ... this is ugly, I'll re-write it better above then delete it
+=head1
+
+ Ugh ... this is ugly, I'll re-write it better above then delete it
     my $norequests = 1;
     my $noitems    = 1;
     if (@items) {
@@ -3404,11 +3385,11 @@
 =cut
 
     push (@newresults, $oldbiblio);
-
     }
     return @newresults;
 }
 
+
 END { }       # module clean-up code here (global destructor)
 
 1;

Index: koha-tmpl/opac-tmpl/prog/en/opac-results.tmpl
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/opac-tmpl/prog/en/Attic/opac-results.tmpl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- koha-tmpl/opac-tmpl/prog/en/opac-results.tmpl       27 Sep 2006 16:14:33 
-0000      1.1.2.1
+++ koha-tmpl/opac-tmpl/prog/en/opac-results.tmpl       6 Oct 2006 13:36:36 
-0000       1.1.2.2
@@ -5,8 +5,9 @@
 <div id="main_wrapper">
 <div id="main" class="searchresults">
 <div class="content-block">
-<!-- TMPL_IF NAME="koha_spsuggest" --><div style="font-size: 12px;">Did you 
mean: <ul style="list-style: none;"><!-- TMPL_LOOP NAME="SPELL_SUGGEST" --> 
<li><a href="/search?q=<!-- TMPL_VAR NAME="spsuggestion" -->"><!-- TMPL_VAR 
NAME="spsuggestion" --></a></li><!-- /TMPL_LOOP --></ul></div><!-- /TMPL_IF -->
+<!-- TMPL_IF NAME="koha_spsuggest" --><div style="font-size: 12px;">Did you 
mean: <ul style="list-style: none;"><!-- TMPL_LOOP NAME="SPELL_SUGGEST" --> 
<li><a href="opac-search.pl?q=<!-- TMPL_VAR NAME="spsuggestion" -->"><!-- 
TMPL_VAR NAME="spsuggestion" --></a></li><!-- /TMPL_LOOP --></ul></div><!-- 
/TMPL_IF -->
 <!-- TMPL_IF NAME="total" -->
+<!-- TMPL_VAR NAME="total" --> results found.
 <!-- TMPL_ELSE -->
 <!-- TMPL_IF NAME="searchdesc" -->
 No results match your search for <span style="font-weight: bold;">&ldquo;<!-- 
TMPL_VAR NAME="searchdesc" -->&rdquo;</span> in <!-- TMPL_VAR 
NAME="LibraryName" --> Catalog.
@@ -22,7 +23,7 @@
 <!-- TMPL_IF NAME="total" -->
 <!-- TMPL_IF NAME="scan" -->
 <h1>Scan Index:</h1>
-                <form action="/search" method="get">
+                <form action="opac-serach.pl" method="get">
 <table>
         <tr><td>
        Scan Index for: <input type="text" name="qf" id="scan-index" size="35" 
value="" />
@@ -49,7 +50,7 @@
 </table>
 </form>
 
-<form action="/search" method="get">
+<form action="opac-search.pl" method="get">
 <table>
        <tr>
                <th>Term/Phrase</th>
@@ -58,7 +59,7 @@
 <!-- TMPL_LOOP NAME="SEARCH_RESULTS" -->
 
                        <tr<!-- TMPL_IF name="even" --> class="highlight"<!-- 
/TMPL_IF -->><td>
-                        <a href="/search?q=<!-- TMPL_VAR NAME="scan_use" 
escape="url" -->&quot;<!-- TMPL_VAR NAME="title" -->&quot;"><!-- TMPL_VAR 
NAME="title" --></a>
+                        <a href="opac-search.pl?q=<!-- TMPL_VAR 
NAME="scan_use" escape="url" -->&quot;<!-- TMPL_VAR NAME="title" 
-->&quot;"><!-- TMPL_VAR NAME="title" --></a>
                        </td>
                        <td>
                        <!-- TMPL_VAR NAME="subtitle" -->
@@ -69,7 +70,7 @@
 </form>
 <!-- TMPL_ELSE -->
 
-<form action="/search" method="get" name="myform" id="mainform">
+<form action="opac-search.pl" method="get" name="myform" id="mainform">
 
 <!--TMPL_IF NAME="opacbookbag" --><a href="#" onclick="CheckAll(); return 
false;"><img src="<!-- TMPL_VAR NAME="themelang" -->/images/checkall.gif" 
height="18" width="18" alt="Check All" title="Check All" border="0" /></a><!-- 
TMPL_ELSE -->&nbsp;<!-- /TMPL_IF -->
 
@@ -96,7 +97,7 @@
                <!-- TMPL_LOOP NAME="SEARCH_RESULTS" -->
                <!-- TMPL_IF name="even" --><tr class="highlight"><!-- 
TMPL_ELSE --><tr><!-- /TMPL_IF -->
                        <td><!-- TMPL_IF NAME="AmazonContent" --><a class="p1" 
href="/cgi-bin/koha/opac-detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" 
ESCAPE="URL" -->"><img src="<!-- TMPL_IF NAME="isbn" 
-->http://images.amazon.com/images/P/<!-- TMPL_VAR name="isbn" 
-->.01.TZZZZZZZ.jpg<!-- TMPL_ELSE 
-->http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif<!-- 
/TMPL_IF -->" alt="image" class="thumbnail" /></a><!-- /TMPL_IF --></td>
-                       <td><!-- TMPL_IF name="BiblioDefaultViewmarc" --><a 
class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?bib=<!-- TMPL_VAR 
NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --> <!-- 
TMPL_VAR NAME="subtitle" --></a><!-- TMPL_ELSE --><!-- TMPL_IF 
name="BiblioDefaultViewisbd" --><a class="title" 
href="/cgi-bin/koha/opac-ISBDdetail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" 
ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" 
--></a><!-- TMPL_ELSE --><a class="title" 
href="/cgi-bin/koha/opac-detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" 
ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" 
--></a><!-- /TMPL_IF --><!-- /TMPL_IF --> <!-- TMPL_IF NAME="author" -->by <a 
href="/search?do=search&amp;q=au:<!-- TMPL_VAR NAME="author" ESCAPE="URL" 
-->"><!-- TMPL_VAR NAME="author" --></a><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF 
-->
+                       <td><!-- TMPL_IF name="BiblioDefaultViewmarc" --><a 
class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?bib=<!-- TMPL_VAR 
NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --> <!-- 
TMPL_VAR NAME="subtitle" --></a><!-- TMPL_ELSE --><!-- TMPL_IF 
name="BiblioDefaultViewisbd" --><a class="title" 
href="/cgi-bin/koha/opac-ISBDdetail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" 
ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" 
--></a><!-- TMPL_ELSE --><a class="title" 
href="/cgi-bin/koha/opac-detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" 
ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" 
--></a><!-- /TMPL_IF --><!-- /TMPL_IF --> <!-- TMPL_IF NAME="author" -->by <a 
href="opac-search.pl?do=search&amp;q=au:<!-- TMPL_VAR NAME="author" 
ESCAPE="URL" -->"><!-- TMPL_VAR NAME="author" --></a><!-- TMPL_ELSE 
-->&nbsp;<!-- /TMPL_IF -->
                                <p> <!-- TMPL_IF name="publicationyear" --> - 
<!-- TMPL_VAR name="publicationyear" --><!-- /TMPL_IF -->
                                                <!-- TMPL_IF 
name="publishercode" -->- <!-- TMPL_VAR name="publishercode" --><!-- /TMPL_IF 
-->
                                                <!-- TMPL_IF name="place" --> ; 
<!-- TMPL_VAR name="place" --><!-- /TMPL_IF -->
@@ -119,7 +120,7 @@
 <!-- TMPL_IF NAME="wthdrawncount" --> Withdrawn (<!-- TMPL_VAR 
NAME="wthdrawncount" -->), <!-- /TMPL_IF -->
 <!-- TMPL_IF NAME="itemlostcount" --> Lost (<!-- TMPL_VAR NAME="itemlostcount" 
-->)<!-- /TMPL_IF --></span>
                                </p>
-                               <p><!-- TMPL_UNLESS NAME="norequests" --><!-- 
TMPL_IF NAME="opacuserlogin" --><a class="reserve" 
href="/cgi-bin/koha/opac-reserve.pl?bib=<!-- TMPL_VAR NAME="biblionumber" 
-->">Place Reserve</a><!-- /TMPL_IF --><!-- /TMPL_UNLESS --> <!--TMPL_IF 
NAME="opacbookbag" --><input type="checkbox" name="bibid" id="bib<!-- TMPL_VAR 
NAME="biblionumber" -->" value="<!-- TMPL_VAR NAME="biblionumber" -->" /> 
<label for="bib<!-- TMPL_VAR NAME="biblionumber" -->"><!-- /TMPL_IF --><img 
src="<!-- TMPL_VAR NAME="themelang" -->/images/<!-- TMPL_VAR NAME="ccode" 
-->.gif" alt="<!-- TMPL_VAR NAME="ccode" -->" title="<!-- TMPL_VAR NAME="ccode" 
-->" /><!--TMPL_IF NAME="opacbookbag" --></label><!-- /TMPL_IF --><a 
href="/search?do=search&amp;q=callnum:<!-- TMPL_VAR NAME="classification" 
ESCAPE="URL" -->"><!-- TMPL_VAR NAME="classification" --></a></p>
+                               <p><!-- TMPL_UNLESS NAME="norequests" --><!-- 
TMPL_IF NAME="opacuserlogin" --><a class="reserve" 
href="/cgi-bin/koha/opac-reserve.pl?bib=<!-- TMPL_VAR NAME="biblionumber" 
-->">Place Reserve</a><!-- /TMPL_IF --><!-- /TMPL_UNLESS --> <!--TMPL_IF 
NAME="opacbookbag" --><input type="checkbox" name="bibid" id="bib<!-- TMPL_VAR 
NAME="biblionumber" -->" value="<!-- TMPL_VAR NAME="biblionumber" -->" /> 
<label for="bib<!-- TMPL_VAR NAME="biblionumber" -->"><!-- /TMPL_IF --><img 
src="<!-- TMPL_VAR NAME="themelang" -->/images/<!-- TMPL_VAR NAME="ccode" 
-->.gif" alt="<!-- TMPL_VAR NAME="ccode" -->" title="<!-- TMPL_VAR NAME="ccode" 
-->" /><!--TMPL_IF NAME="opacbookbag" --></label><!-- /TMPL_IF --><a 
href="opac-search.pl?do=search&amp;q=callnum:<!-- TMPL_VAR 
NAME="classification" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="classification" 
--></a></p>
                        </td>
                </tr>
                <!-- /TMPL_LOOP -->
@@ -129,11 +130,11 @@
 
 <!-- TMPL_IF NAME="PAGE_NUMBERS" --><div class="pages">
     <!-- Row of numbers corresponding to search result pages -->
-       <!-- TMPL_IF NAME="previous_page_offset" --><a class="nav" 
href="/search?do=search&amp;q=<!-- TMPL_VAR NAME="searchdesc" 
-->&amp;offset=<!-- TMPL_VAR NAME="previous_page_offset" -->">&lt;&lt; 
Previous</a><!-- /TMPL_IF -->
+       <!-- TMPL_IF NAME="previous_page_offset" --><a class="nav" 
href="opac-search.pl?do=search&amp;q=<!-- TMPL_VAR NAME="searchdesc" 
-->&amp;offset=<!-- TMPL_VAR NAME="previous_page_offset" -->">&lt;&lt; 
Previous</a><!-- /TMPL_IF -->
     <!-- TMPL_LOOP NAME="PAGE_NUMBERS" --><!-- TMPL_IF NAME="highlight" 
--><span class="current"><!-- TMPL_VAR NAME="pg" --></span><!-- TMPL_ELSE -->
-       <a class="nav" href="/search?do=search&amp;q=<!-- TMPL_VAR 
NAME="searchdesc" -->&amp;offset=<!-- TMPL_VAR NAME="offset" --><!-- TMPL_IF 
NAME="sort_by" -->&amp;sort_by=<!-- TMPL_VAR NAME="sort_by" --><!-- /TMPL_IF 
-->"><!-- TMPL_VAR NAME="pg" --></a><!-- /TMPL_IF -->
+       <a class="nav" href="opac-search.pl?do=search&amp;q=<!-- TMPL_VAR 
NAME="searchdesc" -->&amp;offset=<!-- TMPL_VAR NAME="offset" --><!-- TMPL_IF 
NAME="sort_by" -->&amp;sort_by=<!-- TMPL_VAR NAME="sort_by" --><!-- /TMPL_IF 
-->"><!-- TMPL_VAR NAME="pg" --></a><!-- /TMPL_IF -->
     <!-- /TMPL_LOOP -->
-       <!-- TMPL_IF NAME="next_page_offset" --><a class="nav" 
href="/search?do=search&amp;q=<!-- TMPL_VAR NAME="searchdesc" 
-->&amp;offset=<!-- TMPL_VAR NAME="next_page_offset" -->">Next &gt;&gt;</a><!-- 
/TMPL_IF -->
+       <!-- TMPL_IF NAME="next_page_offset" --><a class="nav" 
href="opac-search.pl?do=search&amp;q=<!-- TMPL_VAR NAME="searchdesc" 
-->&amp;offset=<!-- TMPL_VAR NAME="next_page_offset" -->">Next &gt;&gt;</a><!-- 
/TMPL_IF -->
 </div><!-- /TMPL_IF -->
 
        <!-- TMPL_IF NAME="outer_sup_results_loop" -->

Index: opac/opac-search.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-search.pl,v
retrieving revision 1.38.2.1
retrieving revision 1.38.2.2
diff -u -b -r1.38.2.1 -r1.38.2.2
--- opac/opac-search.pl 28 Sep 2006 08:18:42 -0000      1.38.2.1
+++ opac/opac-search.pl 6 Oct 2006 13:36:36 -0000       1.38.2.2
@@ -3,7 +3,7 @@
 # Script to perform searching
 # For documentation try 'perldoc /path/to/search'
 #
-# $Header: /sources/koha/koha/opac/opac-search.pl,v 1.38.2.1 2006/09/28 
08:18:42 toins Exp $
+# $Header: /sources/koha/koha/opac/opac-search.pl,v 1.38.2.2 2006/10/06 
13:36:36 toins Exp $
 #
 # Copyright 2006 LibLime
 #
@@ -140,7 +140,7 @@
 =cut
 
 use strict;                    # always use
-use warnings;          # use only for development
+#use warnings;         # use only for development
 
 ## STEP 1. Load things that are used in both search page and
 # results page and decide which template to load, operations 
@@ -154,6 +154,8 @@
 use C4::Koha;
 use POSIX qw(ceil floor);
 
+use Data::Dumper;   # FIXME :: don't forget to delete it before release.
+
 # create a new CGI object
 # not sure undef_params option is working, need to test
 use CGI qw('-no_undef_params');
@@ -328,8 +330,7 @@
 my @servers;
 @servers = split("\0",$params->{'server'}) if $params->{'server'};
 unless (@servers) {
-       #FIXME: this should be handled using Context.pm
-       @servers = ("biblioserver");
+    @servers = C4::Context->config("biblioserver");
 }
 
 # operators include boolean and proximity operators and are used
@@ -386,7 +387,6 @@
 eval {
 
        ($error, $results_hashref, $facets) = 
getRecords($koha_query,$federated_query,address@hidden,address@hidden,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
-
 };
 if ($@ || $error) {
        $template->param(query_error => $error.$@);
@@ -394,15 +394,19 @@
        output_html_with_http_headers $cgi, $cookie, $template->output;
        exit;
 }
-
-# At this point, each server has given us a result set
+#At this point, each server has given us a result set
 # now we build that set for template display
+
 my @sup_results_array;
-for (my $i=0;$i<address@hidden;$i++) {
+for (my $i=0;$i<@servers;$i++) {
        my $server = $servers[$i];
-       if ($server =~/biblioserver/) { # this is the local bibliographic server
+
+       if ($server =~/biblio/) { # this is the local bibliographic server
                $hits = $results_hashref->{$server}->{"hits"};
+               
+               # build results for the template.
                my @newresults = searchResults( 
$search_desc,$hits,$results_per_page,$offset,@{$results_hashref->{$server}->{"RECORDS"}});
+
                $total = $total + $results_hashref->{$server}->{"hits"};
                if ($hits) {
                $template->param(total => $hits);
@@ -429,7 +433,7 @@
        } # end of the if local
        else {
                # check if it's a z3950 or opensearch source
-               my $zed3950 = 1;
+               my $zed3950 = 0; # FIXME this value is hardcoded !
                if ($zed3950) {
                        my @inner_sup_results_array;
                        for my $sup_record ( 
@{$results_hashref->{$server}->{"RECORDS"}} ) {
@@ -451,7 +455,6 @@
 
 } #/end of the for loop
 #$template->param(FEDERATED_RESULTS => address@hidden);
-
 
$template->param('Disable_Dictionary'=>C4::Context->preference("Disable_Dictionary"))
 if (C4::Context->preference("Disable_Dictionary"));
 
 $template->param(




reply via email to

[Prev in Thread] Current Thread [Next in Thread]