From 366e1257cc5294272e35fb53deb8e3b19df3f231 Mon Sep 17 00:00:00 2001 From: rangi Date: Thu, 12 Sep 2002 04:37:27 +0000 Subject: [PATCH] quick fix to throw away searches with less than 3 characters in the search term --- C4/Search.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 9a7d7f2837..5d5d3e4bd6 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -101,9 +101,11 @@ sub NewBorrowerNumber { sub catalogsearch { my ($env,$type,$search,$num,$offset)=@_; my $dbh = C4Connect(); -# foreach my $key (%$search){ -# $search->{$key}=$dbh->quote($search->{$key}); -# } + foreach my $key (%$search){ + if (length($search->{$key}) < 3){ + undef ($search->{$key}); + } + } my ($count,@results); # print STDERR "Doing a search $search->{'itemnumber'} $search->{'isbn'}\n"; if ($search->{'itemnumber'} ne '' || $search->{'isbn'} ne ''){ @@ -170,7 +172,7 @@ sub KeywordSearch { my ($env,$type,$search,$num,$offset)=@_; my $dbh = &C4Connect; $search->{'keyword'}=~ s/ +$//; - $search->{'keyword'}=~ s/'/\\'/; + $search->{'keyword'}=~ s/'/\\'/g; my @key=split(' ',$search->{'keyword'}); my $count=@key; my $i=1; -- 2.39.5