Simple search on custom fields

The simple patch below allows you to search on custom fields with the
syntax .fieldName:value.
The : is chosen to match fulltext, although a delimiting = may be
clearer for your users. This was
done so that I could add a “Tags” custom field to queues for free from
annotation & searching
of tickets with relationships that cannot be represented with links
(but perhaps queues, at the
expense of manageability)

— /tmp/Googleish.pm 2008-09-08 12:37:19.000000000 -0400
+++ lib/RT/Search/Googleish.pm 2008-09-08 12:44:21.000000000 -0400
@@ -141,6 +141,10 @@
push @owner_clauses, “Owner = '” . $User->Name . “’”;
}

  •    elsif ( $key =~ /.(\w+):(\w+)/ ) {
    
  •        push @user_clauses, "CF.{$1} LIKE '$2'";
    
  •    }
       # Else, subject must contain $key
       else {
           $key =~ s/['\\].*//g;
    

[

An earlier incarnation matched /cf.(\w+):(\w+)/i but this seemed
unnecessarily verbose.

The text above has been added to the wiki as SearchCustomField
Cambridge Energy Alliance: Save money & the planet

Actually, there’s a typo here, the dot in the RE is missing an escape.
Better still, install the soon to be released RTx::Tags 0.04, which
requires no patching.
Cambridge Energy Alliance: Save money & the planet