[Koha-cvs] koha/C4 SearchMarc.pm [rel_2_2]

paul poulain paul at koha-fr.org
Wed Dec 14 16:58:03 CET 2005


CVSROOT:	/cvsroot/koha
Module name:	koha
Branch: 	rel_2_2
Changes by:	paul poulain <tipaul at savannah.gnu.org>	05/12/14 15:58:03

Modified files:
	C4             : SearchMarc.pm 

Log message:
	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.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/SearchMarc.pm.diff?only_with_tag=rel_2_2&tr1=1.36.2.19&tr2=1.36.2.20&r1=text&r2=text

Patches:
Index: koha/C4/SearchMarc.pm
diff -u koha/C4/SearchMarc.pm:1.36.2.19 koha/C4/SearchMarc.pm:1.36.2.20
--- koha/C4/SearchMarc.pm:1.36.2.19	Thu Dec  1 15:30:53 2005
+++ koha/C4/SearchMarc.pm	Wed Dec 14 15:58:03 2005
@@ -221,7 +221,7 @@
 		@$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 @@
 				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 @@
 				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];





More information about the Koha-cvs mailing list