diff options
Diffstat (limited to 'rt/lib/RT/Search')
-rw-r--r-- | rt/lib/RT/Search/ActiveTicketsInQueue.pm | 5 | ||||
-rw-r--r-- | rt/lib/RT/Search/Simple.pm (renamed from rt/lib/RT/Search/Googleish.pm) | 28 |
2 files changed, 24 insertions, 9 deletions
diff --git a/rt/lib/RT/Search/ActiveTicketsInQueue.pm b/rt/lib/RT/Search/ActiveTicketsInQueue.pm index 8cb6d33..7a1f726 100644 --- a/rt/lib/RT/Search/ActiveTicketsInQueue.pm +++ b/rt/lib/RT/Search/ActiveTicketsInQueue.pm @@ -79,10 +79,7 @@ sub Prepare { my $self = shift; $self->TicketsObj->LimitQueue(VALUE => $self->Argument); - - foreach my $status (RT::Queue->ActiveStatusArray()) { - $self->TicketsObj->LimitStatus(VALUE => $status); - } + $self->TicketsObj->LimitToActiveStatus; return(1); } diff --git a/rt/lib/RT/Search/Googleish.pm b/rt/lib/RT/Search/Simple.pm index a688f58..4cb2482 100644 --- a/rt/lib/RT/Search/Googleish.pm +++ b/rt/lib/RT/Search/Simple.pm @@ -48,19 +48,19 @@ =head1 NAME - RT::Search::Googleish + RT::Search::Simple =head1 SYNOPSIS =head1 DESCRIPTION -Use the argument passed in as a "Google-style" set of keywords +Use the argument passed in as a simple set of keywords =head1 METHODS =cut -package RT::Search::Googleish; +package RT::Search::Simple; use strict; use warnings; @@ -71,6 +71,7 @@ use Regexp::Common qw/delimited/; # Only a subset of limit types AND themselves together. "queue:foo # queue:bar" is an OR, but "subject:foo subject:bar" is an AND our %AND = ( + default => 1, content => 1, subject => 1, ); @@ -173,6 +174,16 @@ sub Finalize { my $self = shift; my ($limits) = @_; + # Assume that numbers were actually "default"s if we have other limits + if ($limits->{id} and keys %{$limits} > 1) { + my $values = delete $limits->{id}; + for my $value (@{$values}) { + $value =~ /(\d+)/ or next; + my ($key, @tsql) = $self->HandleDefault($1); + push @{$limits->{$key}}, @tsql; + } + } + # Apply default "active status" limit if we don't have any status # limits ourselves, and we're not limited by id if (not $limits->{status} and not $limits->{id} @@ -194,7 +205,7 @@ sub Finalize { } our @GUESS = ( - [ 10 => sub { return "subject" if $_[1] } ], + [ 10 => sub { return "default" if $_[1] } ], [ 20 => sub { return "id" if /^#?\d+$/ } ], [ 30 => sub { return "requestor" if /\w+@\w+/} ], [ 35 => sub { return "domain" if /^@\w+/} ], @@ -231,7 +242,14 @@ sub GuessType { # $_[2] is a boolean of "was quoted by the user?" # ensure this is false before you do smart matching like $_[1] eq "me" # $_[3] is escaped subkey, if any (see HandleCf) -sub HandleDefault { return subject => "Subject LIKE '$_[1]'"; } +sub HandleDefault { + my $fts = RT->Config->Get('FullTextSearch'); + if ($fts->{Enable} and $fts->{Indexed}) { + return default => "Content LIKE '$_[1]'"; + } else { + return default => "Subject LIKE '$_[1]'"; + } +} sub HandleSubject { return subject => "Subject LIKE '$_[1]'"; } sub HandleFulltext { return content => "Content LIKE '$_[1]'"; } sub HandleContent { return content => "Content LIKE '$_[1]'"; } |