Skip to content

Commit

Permalink
Bug 1088086: Possible duplicate search doesn't return any results if …
Browse files Browse the repository at this point in the history
…you input "a->b" (for any a/b)

r=dylan,a=glob
  • Loading branch information
globau committed Feb 20, 2015
1 parent 9ec7ae7 commit 720e7d4
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Bugzilla/DB/Mysql.pm
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,19 @@ sub sql_fulltext_search {
if ($text =~ /(?:^|\W)[+\-<>~"()]/ || $text =~ /[()"*](?:$|\W)/) {
$mode = 'IN BOOLEAN MODE';

# quote un-quoted compound words
my @words = 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 . '"';
my @terms = split(quotemeta(FULLTEXT_OR), $text);
foreach my $term (@terms) {
# quote un-quoted compound words
my @words = 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 . '"';
}
}
$term = join('', @words);
}
$text = join('', @words);
$text = join(FULLTEXT_OR, @terms);
}

# quote the text for use in the MATCH AGAINST expression
Expand Down

0 comments on commit 720e7d4

Please sign in to comment.