diff options
author | Matt Tyson <mtyson@redhat.com> | 2015-09-23 23:20:10 +0200 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2015-09-23 23:20:10 +0200 |
commit | 05f74faf6a98ef8d2ac5d38007e093e6fa1bb1fc (patch) | |
tree | a505871a5423ec028877f5c180e16a8c23e41c6a /Bugzilla/Search.pm | |
parent | cdcb6f1f12aff458c43432856a33525f65909276 (diff) | |
download | bugzilla-05f74faf6a98ef8d2ac5d38007e093e6fa1bb1fc.tar.gz bugzilla-05f74faf6a98ef8d2ac5d38007e093e6fa1bb1fc.tar.xz |
Bug 1184431: Bug searching is slow on PostgreSQL
r=LpSolit
Diffstat (limited to 'Bugzilla/Search.pm')
-rw-r--r-- | Bugzilla/Search.pm | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index c8677752e..29ca7b1d9 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -2135,9 +2135,7 @@ sub _substring_terms { # split each term on spaces and commas anyway. my @words = split(/[\s,]+/, $args->{value}); @words = grep { defined $_ and $_ ne '' } @words; - @words = map { $dbh->quote($_) } @words; - my @terms = map { $dbh->sql_iposition($_, $args->{full_field}) . " > 0" } - @words; + my @terms = map { $dbh->sql_ilike($_, $args->{full_field}) } @words; return @terms; } @@ -3223,28 +3221,26 @@ sub _simple_operator { sub _casesubstring { my ($self, $args) = @_; - my ($full_field, $quoted) = @$args{qw(full_field quoted)}; + my ($full_field, $value) = @$args{qw(full_field value)}; my $dbh = Bugzilla->dbh; - - $args->{term} = $dbh->sql_position($quoted, $full_field) . " > 0"; + + $args->{term} = $dbh->sql_like($value, $full_field); } sub _substring { my ($self, $args) = @_; - my ($full_field, $quoted) = @$args{qw(full_field quoted)}; + my ($full_field, $value) = @$args{qw(full_field value)}; my $dbh = Bugzilla->dbh; - - # XXX This should probably be changed to just use LIKE - $args->{term} = $dbh->sql_iposition($quoted, $full_field) . " > 0"; + + $args->{term} = $dbh->sql_ilike($value, $full_field); } sub _notsubstring { my ($self, $args) = @_; - my ($full_field, $quoted) = @$args{qw(full_field quoted)}; + my ($full_field, $value) = @$args{qw(full_field value)}; my $dbh = Bugzilla->dbh; - - # XXX This should probably be changed to just use NOT LIKE - $args->{term} = $dbh->sql_iposition($quoted, $full_field) . " = 0"; + + $args->{term} = $dbh->sql_not_ilike($value, $full_field); } sub _regexp { |