[Koha-cvs] CVS: koha/C4 Search.pm,1.55,1.56

Ambrose Li acli at users.sourceforge.net
Tue Feb 4 05:44:37 CET 2003


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv24134/C4

Modified Files:
	Search.pm 
Log Message:
Reverted to using s/// instead of quotemeta for title/author/illustrator,
to avoid quoting spaces (which results in most titles/authors etc. becoming
unsearchable) (Bug 197)


Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -r1.55 -r1.56
*** Search.pm	3 Feb 2003 02:15:43 -0000	1.55
--- Search.pm	4 Feb 2003 04:44:35 -0000	1.56
***************
*** 859,865 ****
  	my $query = '';
  	my @results;
  	for my $field ('title', 'author', 'illustrator') {
! 	    $search->{$field} = quotemeta($search->{$field});
  	}
  	my $title = lc($search->{'title'});
  	if ($type eq 'loose') {
--- 859,872 ----
  	my $query = '';
  	my @results;
+ 
+ 	# Why not just use quotemeta to escape all questionable characters,
+ 	# not just single-quotes? Because that would also escape spaces,
+ 	# which would cause titles/authors/illustrators with a space to
+ 	# become unsearchable (Bug 197)
+ 
  	for my $field ('title', 'author', 'illustrator') {
! 	    $search->{$field} =~ s/['"]/\\\1/g;
  	}
+ 
  	my $title = lc($search->{'title'});
  	if ($type eq 'loose') {





More information about the Koha-cvs mailing list