summaryrefslogtreecommitdiff
path: root/rt/lib/RT/Search
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-09-23 14:56:51 -0700
committerIvan Kohler <ivan@freeside.biz>2012-09-23 14:56:51 -0700
commit0bff2e665b3a6389b47510e4c04a5a454f6dd7d4 (patch)
treee7f3368c067594b98699c5cf62f0991e8ceb2e4f /rt/lib/RT/Search
parent806d426d106efea2b2b13314108c4ac046511e1c (diff)
rt 4.0.7
Diffstat (limited to 'rt/lib/RT/Search')
-rw-r--r--rt/lib/RT/Search/Googleish.pm16
1 files changed, 14 insertions, 2 deletions
diff --git a/rt/lib/RT/Search/Googleish.pm b/rt/lib/RT/Search/Googleish.pm
index a1254836a..1b4071f4d 100644
--- a/rt/lib/RT/Search/Googleish.pm
+++ b/rt/lib/RT/Search/Googleish.pm
@@ -110,7 +110,7 @@ sub QueryToSQL {
(\w+) # A straight word
(?:\. # With an optional .foo
($RE{delimited}{-delim=>q['"]}
- |\w+
+ |[\w-]+ # Allow \w + dashes
) # Which could be ."foo bar", too
)?
)
@@ -225,6 +225,11 @@ sub GuessType {
return "default";
}
+# $_[0] is $self
+# $_[1] is escaped value without surrounding single quotes
+# $_[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 HandleSubject { return subject => "Subject LIKE '$_[1]'"; }
sub HandleFulltext { return content => "Content LIKE '$_[1]'"; }
@@ -242,7 +247,14 @@ sub HandleStatus {
}
}
sub HandleOwner {
- return owner => (!$_[2] and $_[1] eq "me") ? "Owner.id = '__CurrentUser__'" : "Owner = '$_[1]'";
+ if (!$_[2] and $_[1] eq "me") {
+ return owner => "Owner.id = '__CurrentUser__'";
+ }
+ elsif (!$_[2] and $_[1] =~ /\w+@\w+/) {
+ return owner => "Owner.EmailAddress = '$_[1]'";
+ } else {
+ return owner => "Owner = '$_[1]'";
+ }
}
sub HandleWatcher {
return watcher => (!$_[2] and $_[1] eq "me") ? "Watcher.id = '__CurrentUser__'" : "Watcher = '$_[1]'";