[Rt-commit] rt branch, 4.0/any-in-simple-search, created. rt-4.0.4-110-gb8be666
Ruslan Zakirov
ruz at bestpractical.com
Tue Dec 6 06:14:25 EST 2011
The branch, 4.0/any-in-simple-search has been created
at b8be666660ea3ef80747dbf219897872b953a7a3 (commit)
- Log -----------------------------------------------------------------
commit 9851f0a84c13796a88322559276498a8e8cd71ec
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Tue Dec 6 15:11:40 2011 +0400
skip empty bundle in Googleish
for example status => [] can be used to avoid finalization
diff --git a/lib/RT/Search/Googleish.pm b/lib/RT/Search/Googleish.pm
index 694ec01..1f54449 100644
--- a/lib/RT/Search/Googleish.pm
+++ b/lib/RT/Search/Googleish.pm
@@ -133,6 +133,8 @@ sub QueryToSQL {
my @clauses;
for my $subclause (sort keys %limits) {
+ next unless @{$limits{$subclause}};
+
my $op = $AND{lc $subclause} ? "AND" : "OR";
push @clauses, "( ".join(" $op ", @{$limits{$subclause}})." )";
}
commit b8be666660ea3ef80747dbf219897872b953a7a3
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Tue Dec 6 15:13:33 2011 +0400
any keyword in simple search, means any status
diff --git a/lib/RT/Search/Googleish.pm b/lib/RT/Search/Googleish.pm
index 1f54449..734d150 100644
--- a/lib/RT/Search/Googleish.pm
+++ b/lib/RT/Search/Googleish.pm
@@ -200,7 +200,7 @@ our @GUESS = (
[ 40 => sub {
return "status" if RT::Queue->new( $_[2] )->IsValidStatus( $_ )
}],
- [ 40 => sub { return "status" if /^(in)?active$/i } ],
+ [ 40 => sub { return "status" if /^((in)?active|any)$/i } ],
[ 50 => sub {
my $q = RT::Queue->new( $_[2] );
return "queue" if $q->Load($_) and $q->Id
@@ -235,6 +235,8 @@ sub HandleStatus {
return status => map {s/(['\\])/\\$1/g; "Status = '$_'"} RT::Queue->ActiveStatusArray();
} elsif ($_[1] =~ /^inactive$/i and !$_[2]) {
return status => map {s/(['\\])/\\$1/g; "Status = '$_'"} RT::Queue->InactiveStatusArray();
+ } elsif ($_[1] =~ /^any$/i and !$_[2]) {
+ return 'status';
} else {
return status => "Status = '$_[1]'";
}
diff --git a/t/ticket/googleish_search.t b/t/ticket/googleish_search.t
index 5d7809a..aa33257 100644
--- a/t/ticket/googleish_search.t
+++ b/t/ticket/googleish_search.t
@@ -4,7 +4,7 @@
use strict;
use warnings;
-use RT::Test tests => 10;
+use RT::Test tests => 12;
use_ok('RT');
@@ -30,6 +30,8 @@ my $quick = RT::Search::Googleish->new(Argument => "",
TicketsObj => $tickets);
my @tests = (
"General new open root" => "( Owner = 'root' ) AND ( Queue = 'General' ) AND ( Status = 'new' OR Status = 'open' )",
+ "General" => "( Queue = 'General' ) AND ( $active_statuses )",
+ "General any" => "( Queue = 'General' )",
"fulltext:jesse" => "( Content LIKE 'jesse' ) AND ( $active_statuses )",
$queue => "( Queue = '$queue' ) AND ( $active_statuses )",
"root $queue" => "( Owner = 'root' ) AND ( Queue = '$queue' ) AND ( $active_statuses )",
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list