Commit 8e16a58f authored by Byron Jones's avatar Byron Jones

Bug 880315: Fix malformed sql generated by the fix for bug 879055

r=LpSolit, a=LpSolit
parent a905395d
...@@ -2926,14 +2926,14 @@ sub _anywordsubstr { ...@@ -2926,14 +2926,14 @@ sub _anywordsubstr {
my ($self, $args) = @_; my ($self, $args) = @_;
my @terms = $self->_substring_terms($args); my @terms = $self->_substring_terms($args);
$args->{term} = '(' . join("\n\tOR ", @terms) . ')'; $args->{term} = @terms ? '(' . join("\n\tOR ", @terms) . ')' : '';
} }
sub _allwordssubstr { sub _allwordssubstr {
my ($self, $args) = @_; my ($self, $args) = @_;
my @terms = $self->_substring_terms($args); my @terms = $self->_substring_terms($args);
$args->{term} = '(' . join("\n\tAND ", @terms) . ')'; $args->{term} = @terms ? '(' . join("\n\tAND ", @terms) . ')' : '';
} }
sub _nowordssubstr { sub _nowordssubstr {
...@@ -2950,14 +2950,14 @@ sub _anywords { ...@@ -2950,14 +2950,14 @@ sub _anywords {
# Because _word_terms uses AND, we need to parenthesize its terms # Because _word_terms uses AND, we need to parenthesize its terms
# if there are more than one. # if there are more than one.
@terms = map("($_)", @terms) if scalar(@terms) > 1; @terms = map("($_)", @terms) if scalar(@terms) > 1;
$args->{term} = '(' . join("\n\tOR ", @terms) . ')'; $args->{term} = @terms ? '(' . join("\n\tOR ", @terms) . ')' : '';
} }
sub _allwords { sub _allwords {
my ($self, $args) = @_; my ($self, $args) = @_;
my @terms = $self->_word_terms($args); my @terms = $self->_word_terms($args);
$args->{term} = '(' . join("\n\tAND ", @terms) . ')'; $args->{term} = @terms ? '(' . join("\n\tAND ", @terms) . ')' : '';
} }
sub _nowords { sub _nowords {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment