[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-devel] CVS: koha/C4 Search.pm,1.12,1.13
From: |
Chris Cormack |
Subject: |
[Koha-devel] CVS: koha/C4 Search.pm,1.12,1.13 |
Date: |
Wed Feb 20 12:56:09 2002 |
Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv10405/C4
Modified Files:
Search.pm
Log Message:
Playing with keyword search trying to speed it up more
Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** Search.pm 12 Feb 2002 21:31:41 -0000 1.12
--- Search.pm 20 Feb 2002 20:53:29 -0000 1.13
***************
*** 339,342 ****
--- 339,345 ----
}
my $i2=0;
+ my $i3=0;
+ my $i4=0;
+
my @res2;
my @res = $set1->members;
***************
*** 345,352 ****
$i=0;
# print "count $count";
while ($i2 < $num && $i2 < $count){
my $query="select * from biblio,biblioitems where
biblio.biblionumber='$res[$i2+$offset]' and
! biblio.biblionumber=biblioitems.biblionumber";
if ($search->{'class'} ne ''){
my @temp=split(/\|/,$search->{'class'});
--- 348,399 ----
$i=0;
# print "count $count";
+ if ($search->{'class'} ne ''){
+ while ($i2 <$count){
+ my $query="select * from biblio,biblioitems where
+ biblio.biblionumber='$res[$i2]' and
+ biblio.biblionumber=biblioitems.biblionumber ";
+ if ($search->{'class'} ne ''){
+ my @temp=split(/\|/,$search->{'class'});
+ my address@hidden;
+ $query.= "and ( itemtype='$temp[0]'";
+ for (my $i=1;$i<$count;$i++){
+ $query.=" or itemtype='$temp[$i]'";
+ }
+ $query.=")";
+ }
+ my $sth=$dbh->prepare($query);
+ # print $query;
+ $sth->execute;
+ if (my $data2=$sth->fetchrow_hashref){
+ my $dewey= $data2->{'dewey'};
+ my $subclass=$data2->{'subclass'};
+ $dewey=~s/\.*0*$//;
+ ($dewey == 0) && ($dewey='');
+ ($dewey) && ($dewey.=" $subclass") ;
+ $sth->finish;
+ my $end=$offset +$num;
+ if ($i4 <= $offset){
+ $i4++;
+ }
+ # print $i4;
+ if ($i4 <=$end && $i4 > $offset){
+
$res2[$i3]="$data2->{'author'}\t$data2->{'title'}\t$data2->{'biblionumber'}\t$data2->{'copyrightdate'}\t$dewey";
+ $i3++;
+ $i4++;
+ # print "in here $i3<br>";
+ } else {
+ # print $end;
+ }
+ $i++;
+ }
+ $i2++;
+ }
+ $count=$i;
+
+ } else {
while ($i2 < $num && $i2 < $count){
my $query="select * from biblio,biblioitems where
biblio.biblionumber='$res[$i2+$offset]' and
! biblio.biblionumber=biblioitems.biblionumber ";
if ($search->{'class'} ne ''){
my @temp=split(/\|/,$search->{'class'});
***************
*** 376,383 ****
}
$i2++;
}
$dbh->disconnect;
! # $count=$i;
return($count,@res2);
}
--- 423,432 ----
}
$i2++;
+
+ }
}
$dbh->disconnect;
! #$count=$i;
return($count,@res2);
}
***************
*** 1174,1200 ****
}
! sub allissues {
! my ($bornum)address@hidden;
! my $dbh=C4Connect;
! my $query;
! $query="Select * from issues,biblio,items where borrowernumber='$bornum' and
! items.itemnumber=issues.itemnumber and
! items.biblionumber=biblio.biblionumber order
! by date_due";
! #print $query;
! my $sth=$dbh->prepare($query);
! $sth->execute;
! my @result;
! my $i=0;
! while (my $data=$sth->fetchrow_hashref){
! $result[$i]=$data;;
! $i++;
! }
! $sth->finish;
! $dbh->disconnect;
! return($i,address@hidden);
}
-
-
sub borrdata2 {
--- 1223,1252 ----
}
! sub allissues {
! my ($bornum,$order,$limit)address@hidden;
! my $dbh=C4Connect;
! my $query;
! $query="Select * from issues,biblio,items,biblioitems
! where borrowernumber='$bornum' and
! items.biblioitemnumber=biblioitems.biblioitemnumber and
! items.itemnumber=issues.itemnumber and
! items.biblionumber=biblio.biblionumber";
! $query.=" order by $order";
! if ($limit !=0){
! $query.=" limit $limit";
! }
! #print $query;
! my $sth=$dbh->prepare($query);
! $sth->execute;
! my @result;
! my $i=0;
! while (my $data=$sth->fetchrow_hashref){
! $result[$i]=$data;;
! $i++;
! }
! $sth->finish;
! $dbh->disconnect;
! return($i,address@hidden);
}
sub borrdata2 {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-devel] CVS: koha/C4 Search.pm,1.12,1.13,
Chris Cormack <=