koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/search.marc dictionary.pl,1.3,1.4


From: Henri-Damien LAURENT
Subject: [Koha-cvs] CVS: koha/search.marc dictionary.pl,1.3,1.4
Date: Tue, 03 May 2005 08:00:34 -0700

Update of /cvsroot/koha/koha/search.marc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24508/search.marc

Modified Files:
        dictionary.pl 
Log Message:
Improving Interface.

Index: dictionary.pl
===================================================================
RCS file: /cvsroot/koha/koha/search.marc/dictionary.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** dictionary.pl       2 May 2005 15:59:49 -0000       1.3
--- dictionary.pl       3 May 2005 15:00:32 -0000       1.4
***************
*** 76,83 ****
        while ((my $tagfield,my $tagsubfield,my $liblibrarian) = 
$sth->fetchrow) {
                push @tags, $dbh->quote("$tagfield$tagsubfield");
-               push @and_or, "";
-               push @operator, "contains";
-               push @excluding, "";
-               push @value, @search ;
        }
  
--- 76,79 ----
***************
*** 90,124 ****
  
  
!       my ($results,$total) = catalogsearch($dbh,address@hidden 
,address@hidden,
!                                                                               
address@hidden, address@hidden,  address@hidden,
!                                                                               
$startfrom*$resultsperpage, $resultsperpage,$orderby);
!       my %seen = ();
! 
!       foreach my $item (@$results) {
!               my $display;
!               $display="author" if ($field=~/author/);
!               $display="title" if ($field=~/title/);
!               $display="subject" if ($field=~/subject/);
!               $display="publishercode" if ($field=~/publisher/);
!           $seen{$item->{$display}}++;
!       }
        my @catresults;
!       foreach my $name (sort keys %seen){
!               push @catresults, { value => $name , count => $seen{$name}}
        }
  
!       my $strsth="Select distinct authtypecode from marc_subfield_structure 
where ";
!       my $strtagfields="tagfield in (";
!       my $strtagsubfields=" and tagsubfield in (";
        foreach my $listtags (@tags){
                my @taglist=split /,/,$listtags;
                foreach my $curtag (@taglist){
!                       
$strtagfields=$strtagfields."'".substr($curtag,1,3)."',";
!                       
$strtagsubfields=$strtagsubfields."'".substr($curtag,4,1)."',";
                }
        }
!       $strtagfields=~s/,$/)/;
!       $strtagsubfields=~s/,$/)/;
!       my $strsth = $strsth.$strtagfields.$strtagsubfields." and authtypecode 
is not NULL";
        warn $strsth;
        my $sth=$dbh->prepare($strsth);
--- 86,130 ----
  
  
!       my @results, my $total;
! #     my ($results,$total) = catalogsearch($dbh,address@hidden 
,address@hidden,
! #                                                                             
address@hidden, address@hidden,  address@hidden,
! #                                                                             
$startfrom*$resultsperpage, $resultsperpage,$orderby);
!       my $strsth="select distinct subfieldvalue, 
count(marc_subfield_table.bibid) from marc_subfield_table,marc_word where 
marc_word.word like ? and marc_subfield_table.bibid=marc_word.bibid and 
marc_word.tagsubfield in ";
!       my $listtags="(";
!       foreach my $tag (@tags){
!               $listtags .= $tag .",";
!       }
!       $listtags =~s/,$/)/;
!       $strsth .= $listtags." and 
marc_word.tagsubfield=marc_subfield_table.tag+marc_subfield_table.subfieldcode 
group by subfieldvalue ";
!       warn "".$strsth;
!       my $value = uc($search[0]);
!       $value=~s/\*/%/g;
!       $value.= "%" if not($value=~m/%/);
!       warn " texte : ".$value;
! 
!       $sth=$dbh->prepare($strsth);
!       $sth->execute($value);
!       my $total;
        my @catresults;
!       while (my ($value,$ctresults)=$sth->fetchrow) {
!               warn "countresults : ".$ctresults;
!               push @catresults,{value=> $value, 
!                                                 
even=>($total-$startfrom*$resultsperpage)%2,
!                                                 count=>$ctresults
!                                                 } if 
(($total>=$startfrom*$resultsperpage) and 
($total<($startfrom+1)*$resultsperpage));
!               $total++;
        }
+       
  
!       my $strsth="Select distinct authtypecode from marc_subfield_structure 
where (";
        foreach my $listtags (@tags){
                my @taglist=split /,/,$listtags;
                foreach my $curtag (@taglist){
!                       $strsth.="(tagfield='".substr($curtag,1,3)."' AND 
tagsubfield='".substr($curtag,4,1)."') OR";
                }
        }
!       
!       $strsth=~s/ OR$/)/;
!       my $strsth = $strsth." and authtypecode is not NULL";
        warn $strsth;
        my $sth=$dbh->prepare($strsth);
***************
*** 186,190 ****
                $to = (($startfrom+1)*$resultsperpage);
        }
!       $template->param(result => $results,
                                         catresult=> address@hidden,
                                                search => $search[0],
--- 192,196 ----
                $to = (($startfrom+1)*$resultsperpage);
        }
!       $template->param(result => address@hidden,
                                         catresult=> address@hidden,
                                                search => $search[0],




reply via email to

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