Bug Fixing MT 2095 : Add_excepti.al Search broken on QueryStemming

This commit is contained in:
root 2009-10-16 23:40:13 +02:00 committed by Henri-Damien LAURENT
parent d5cd90ba26
commit e964e49c89

View file

@ -695,7 +695,7 @@ sub _detect_truncation {
# STEMMING # STEMMING
sub _build_stemmed_operand { sub _build_stemmed_operand {
my ($operand,$lang) = @_; my ($operand,$lang) = @_;
require Lingua::Stem::Snowball; require Lingua::Stem::Snowball ;
my $stemmed_operand; my $stemmed_operand;
# If operand contains a digit, it is almost certainly an identifier, and should # If operand contains a digit, it is almost certainly an identifier, and should
@ -706,18 +706,10 @@ sub _build_stemmed_operand {
return $operand if $operand =~ /\d/; return $operand if $operand =~ /\d/;
# FIXME: the locale should be set based on the user's language and/or search choice # FIXME: the locale should be set based on the user's language and/or search choice
warn "$lang";
my $stemmer = Lingua::Stem::Snowball->new( lang => $lang, my $stemmer = Lingua::Stem::Snowball->new( lang => $lang,
encoding => "UTF-8" ); encoding => "UTF-8" );
# FIXME: these should be stored in the db so the librarian can modify the behavior
# Lingua::Stem can't add exceptions
# $stemmer->add_exceptions(
# {
# 'and' => 'and',
# 'or' => 'or',
# 'not' => 'not',
# }
# );
my @words = split( / /, $operand ); my @words = split( / /, $operand );
my @stems = $stemmer->stem(\@words); my @stems = $stemmer->stem(\@words);
for my $stem (@stems) { for my $stem (@stems) {