From 211b2afb74fdcb6ef3351cc95a67c483cc194842 Mon Sep 17 00:00:00 2001 From: tipaul Date: Wed, 14 Dec 2005 15:58:03 +0000 Subject: [PATCH] small bug, large effects. there was a SQL statement added when 2 search term were separated by 2 empty char (spaces, comma, dot...) or more. --- C4/SearchMarc.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/C4/SearchMarc.pm b/C4/SearchMarc.pm index 53573c414e..9a3adb5845 100644 --- a/C4/SearchMarc.pm +++ b/C4/SearchMarc.pm @@ -221,7 +221,7 @@ sub catalogsearch { @$value[$i] =~ s/\*/%/g; # remove % at the beginning @$value[$i] =~ s/^%//g; - @$value[$i] =~ s/(\.|\?|\:|\!|\'|,|\-|\"|\(|\)|\[|\]|\{|\}|\/)/ /g if @$operator[$i] eq "contains"; + @$value[$i] =~ s/(\.|\?|\:|\!|\'|,|\-|\"|\(|\)|\[|\]|\{|\}|\/|--)/ /g if @$operator[$i] eq "contains"; if(@$excluding[$i]) # NOT statements { $any_not = 1; @@ -230,9 +230,8 @@ sub catalogsearch { foreach my $word (split(/ /, @$value[$i])) # if operator is contains, splits the words in separate requests { # remove the "%" for small word (3 letters. (note : the >4 is due to the % at the end) -# warn "word : $word"; $word =~ s/%//g unless length($word)>4; - unless (C4::Context->stopwords->{uc($word)} or length($word)==1) { #it's NOT a stopword => use it. Otherwise, ignore + unless (C4::Context->stopwords->{uc($word)} or length($word)<=1) { #it's NOT a stopword => use it. Otherwise, ignore push @not_tags, @$tags[$i]; push @not_and_or, "or"; # as request is negated, finds "foo" or "bar" if final request is NOT "foo" and "bar" push @not_operator, @$operator[$i]; @@ -255,9 +254,9 @@ sub catalogsearch { foreach my $word (split(/ /, @$value[$i])) { # remove the "%" for small word (3 letters. (note : the >4 is due to the % at the end) -# warn "word : $word"; + warn "word : $word"; $word =~ s/%//g unless length($word)>4; - unless (C4::Context->stopwords->{uc($word)} or length($word)==1) { #it's NOT a stopword => use it. Otherwise, ignore + unless (C4::Context->stopwords->{uc($word)} or length($word)<=1) { #it's NOT a stopword => use it. Otherwise, ignore push @normal_tags, @$tags[$i]; push @normal_and_or, "and"; # assumes "foo" and "bar" if "foo bar" is entered push @normal_operator, @$operator[$i]; -- 2.39.5