diff options
author | Byron Jones <glob@mozilla.com> | 2015-02-20 06:51:01 +0100 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-02-20 06:51:01 +0100 |
commit | 3978f0c73178259d1dc6cf3e8625f3ec4dbfcb05 (patch) | |
tree | 1ee98fee1bb2a49d83cf26526953301244229fdc | |
parent | ac997a9166d6ac7ab0822f6935679fa0394eeb58 (diff) | |
download | bugzilla-3978f0c73178259d1dc6cf3e8625f3ec4dbfcb05.tar.gz bugzilla-3978f0c73178259d1dc6cf3e8625f3ec4dbfcb05.tar.xz |
Bug 1088086: Possible duplicate search doesn't return any results if you input "a->b" (for any a/b)
-rw-r--r-- | Bugzilla/DB/Mysql.pm | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index d642b5825..bf8854c9c 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -180,19 +180,22 @@ sub sql_fulltext_search { if ($text =~ /(?:^|\W)[+\-<>~"()]/ || $text =~ /[()"*](?:$|\W)/) { $mode = 'IN BOOLEAN MODE'; - # quote un-quoted compound words - my @words = grep { defined } quotewords('[\s()]+', 'delimiters', $text); - foreach my $word (@words) { - # match words that have non-word chars in the middle of them - if ($word =~ /\w\W+\w/ && $word !~ m/"/) { - $word = '"' . $word . '"'; - } - # match words that contain only boolean operators - elsif ($word =~ /^[\+\-\<\>\~\*]+$/) { - $word = '"' . $word . '"'; + my @terms = split(quotemeta(FULLTEXT_OR), $text); + foreach my $term (@terms) { + # quote un-quoted compound words + my @words = grep { defined } quotewords('[\s()]+', 'delimiters', $term); + foreach my $word (@words) { + # match words that have non-word chars in the middle of them + if ($word =~ /\w\W+\w/ && $word !~ m/"/) { + $word = '"' . $word . '"'; + # match words that contain only boolean operators + } elsif ($word =~ /^[\+\-\<\>\~\*]+$/) { + $word = '"' . $word . '"'; + } } + $term = join('', @words); } - $text = join('', @words); + $text = join(FULLTEXT_OR, @terms); } # quote the text for use in the MATCH AGAINST expression |