[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-devel] CVS: koha/C4 Search.pm,1.16,1.17
From: |
Chris Cormack |
Subject: |
[Koha-devel] CVS: koha/C4 Search.pm,1.16,1.17 |
Date: |
Wed Apr 10 14:25:39 2002 |
Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv30778/C4
Modified Files:
Search.pm
Log Message:
Working on a fix to speed up title and author searches
Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** Search.pm 13 Mar 2002 07:36:49 -0000 1.16
--- Search.pm 10 Apr 2002 07:59:28 -0000 1.17
***************
*** 463,471 ****
my $i=1;
$query="select *,biblio.author,biblio.biblionumber from
! biblioitems,biblio
left join additionalauthors
on additionalauthors.biblionumber =biblio.biblionumber
! where biblioitems.biblionumber=biblio.biblionumber
! and
((biblio.author like '$key[0]%' or biblio.author like '% $key[0]%' or
additionalauthors.author like '$key[0]%' or additionalauthors.author
--- 463,470 ----
my $i=1;
$query="select *,biblio.author,biblio.biblionumber from
! biblio
left join additionalauthors
on additionalauthors.biblionumber =biblio.biblionumber
! where
((biblio.author like '$key[0]%' or biblio.author like '% $key[0]%' or
additionalauthors.author like '$key[0]%' or additionalauthors.author
***************
*** 505,524 ****
#or seriestitle like '%$search->{'title'}%')";
}
! 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.=") ";
! }
! if ($search->{'dewey'} ne ''){
! $query.=" and dewey='$search->{'dewey'}' ";
! }
! if ($search->{'illustrator'} ne ''){
! $query.=" and illus like '%".$search->{'illustrator'}."%' ";
! }
!
$query.=" group by biblio.biblionumber";
} else {
--- 504,508 ----
#or seriestitle like '%$search->{'title'}%')";
}
!
$query.=" group by biblio.biblionumber";
} else {
***************
*** 540,548 ****
my address@hidden;
my $i=1;
! $query="select * from biblio,biblioitems
left join bibliosubtitle on
biblio.biblionumber=bibliosubtitle.biblionumber
where
- biblioitems.biblionumber=biblio.biblionumber and
(((title like '$key[0]%' or title like '% $key[0]%' or title like
'% $key[0]')";
while ($i<$count){
--- 524,531 ----
my address@hidden;
my $i=1;
! $query="select * from biblio
left join bibliosubtitle on
biblio.biblionumber=bibliosubtitle.biblionumber
where
(((title like '$key[0]%' or title like '% $key[0]%' or title like
'% $key[0]')";
while ($i<$count){
***************
*** 563,581 ****
}
$query=$query."))";
- 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.=")";
- }
- if ($search->{'dewey'} ne ''){
- $query.=" and dewey='$search->{'dewey'}' ";
- }
- if ($search->{'illustrator'} ne ''){
- $query.=" and illus like '%".$search->{'illustrator'}."%' ";
- }
}
} elsif ($search->{'class'} ne ''){
--- 546,549 ----
***************
*** 681,691 ****
my $limit= $num+$offset;
while (my $data=$sth->fetchrow_hashref){
! my $sti=$dbh->prepare("select dewey,subclass from biblioitems where
biblionumber=$data->{'biblionumber'}");
$sti->execute;
! my ($dewey, $subclass) = $sti->fetchrow;
$dewey=~s/\.*0*$//;
($dewey == 0) && ($dewey='');
($dewey) && ($dewey.=" $subclass");
$sti->finish;
if ($count > $offset && $count <= $limit){
if ($type ne 'subject' && $type ne 'precise'){
--- 649,682 ----
my $limit= $num+$offset;
while (my $data=$sth->fetchrow_hashref){
! my $query="select dewey,subclass from biblioitems where
biblionumber=$data->{'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.=")";
! }
! if ($search->{'dewey'} ne ''){
! $query.=" and dewey='$search->{'dewey'}' ";
! }
! if ($search->{'illustrator'} ne ''){
! $query.=" and illus like '%".$search->{'illustrator'}."%' ";
! }
! #print $query;
! my $sti=$dbh->prepare($query);
$sti->execute;
! my $dewey;
! my $subclass;
! my $true=0;
! if (($dewey, $subclass) = $sti->fetchrow){
! $true=1;
! }
$dewey=~s/\.*0*$//;
($dewey == 0) && ($dewey='');
($dewey) && ($dewey.=" $subclass");
$sti->finish;
+ if ($true == 1){
if ($count > $offset && $count <= $limit){
if ($type ne 'subject' && $type ne 'precise'){
***************
*** 699,702 ****
--- 690,694 ----
}
$count++;
+ }
}
$sth->finish;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-devel] CVS: koha/C4 Search.pm,1.16,1.17,
Chris Cormack <=