diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2015-07-26 15:41:26 -0700 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2015-07-26 15:41:26 -0700 |
| commit | 9aee669886202be7035e6c6049fc71bc99dd3013 (patch) | |
| tree | 2fd5bf6de74f3d99270587ffb1833e4188a6373d /rt/lib/RT/Search | |
| parent | ac20214d38d9af00430423f147b5a0e50751b050 (diff) | |
| parent | 1add633372bdca3cc7163c2ce48363fed3984437 (diff) | |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'rt/lib/RT/Search')
| -rw-r--r-- | rt/lib/RT/Search/ActiveTicketsInQueue.pm | 7 | ||||
| -rw-r--r-- | rt/lib/RT/Search/FromSQL.pm | 2 | ||||
| -rw-r--r-- | rt/lib/RT/Search/Simple.pm (renamed from rt/lib/RT/Search/Googleish.pm) | 30 |
3 files changed, 27 insertions, 12 deletions
diff --git a/rt/lib/RT/Search/ActiveTicketsInQueue.pm b/rt/lib/RT/Search/ActiveTicketsInQueue.pm index 1c69e93b2..7a1f72661 100644 --- a/rt/lib/RT/Search/ActiveTicketsInQueue.pm +++ b/rt/lib/RT/Search/ActiveTicketsInQueue.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC # <sales@bestpractical.com> # # (Except where explicitly superseded by other copyright notices) @@ -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/FromSQL.pm b/rt/lib/RT/Search/FromSQL.pm index 2f27fee82..dbcad9099 100644 --- a/rt/lib/RT/Search/FromSQL.pm +++ b/rt/lib/RT/Search/FromSQL.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC # <sales@bestpractical.com> # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Search/Googleish.pm b/rt/lib/RT/Search/Simple.pm index d11fa2b13..4cb2482db 100644 --- a/rt/lib/RT/Search/Googleish.pm +++ b/rt/lib/RT/Search/Simple.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC # <sales@bestpractical.com> # # (Except where explicitly superseded by other copyright notices) @@ -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]'"; } |
