From 2f28f2fdf5baf5f093a162fe5ded1c5a07346739 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 2 Sep 2009 17:38:37 +0200 Subject: [PATCH] Adding autotruncation Signed-off-by: Galen Charlton --- C4/Search.pm | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index fa3950f679..27bceb4a33 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -922,16 +922,6 @@ sub buildQuery { # Some helpful index variants my $index_plus = $index . $struct_attr . ":" if $index; my $index_plus_comma = $index . $struct_attr . "," if $index; - if ($auto_truncation){ -# FIXME Auto Truncation is only valid for LTR languages -# use C4::Output; -# use C4::Languages qw(regex_lang_subtags get_bidi); -# $lang = $query->cookie('KohaOpacLanguage') if (defined $query && $query->cookie('KohaOpacLanguage')); -# my $current_lang = regex_lang_subtags($lang); -# my $bidi; -# $bidi = get_bidi($current_lang->{script}) if $current_lang->{script}; - $index_plus_comma .= "rtrn:"; - } # Remove Stopwords if ($remove_stopwords) { @@ -942,6 +932,10 @@ sub buildQuery { if ( $stopwords_removed && $DEBUG ); } + if ($auto_truncation){ + $operand=~join(" ",map{ "$_*" }split (/\s+/,$operand)); + } + # Detect Truncation my $truncated_operand; my( $nontruncated, $righttruncated, $lefttruncated, -- 2.20.1