From 85b59ff91d64a27a79ced81efd1ed81f10dcfec2 Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Fri, 8 Aug 2008 14:09:52 -0500 Subject: [PATCH] Partial fix for 2446: single word queries that were stopwords weren't being striped out of the query --- C4/Search.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index e350ff3100..1509f49099 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -33,7 +33,7 @@ BEGIN { $VERSION = 3.01; $DEBUG = ($ENV{DEBUG}) ? 1 : 0; } - +$DEBUG=1; =head1 NAME C4::Search - Functions for searching the Koha catalog. @@ -702,11 +702,12 @@ sub _remove_stopwords { foreach ( keys %{ C4::Context->stopwords } ) { next if ( $_ =~ /(and|or|not)/ ); # don't remove operators if ( $operand =~ - /(\P{IsAlpha}$_\P{IsAlpha}|^$_\P{IsAlpha}|\P{IsAlpha}$_$)/ ) + /(\P{IsAlpha}$_\P{IsAlpha}|^$_\P{IsAlpha}|\P{IsAlpha}$_$|^$_$)/ ) { $operand =~ s/\P{IsAlpha}$_\P{IsAlpha}/ /gi; $operand =~ s/^$_\P{IsAlpha}/ /gi; $operand =~ s/\P{IsAlpha}$_$/ /gi; + $operand =~ s/$1//gi; push @stopwords_removed, $_; } } -- 2.39.2