SearchCustomField
Jump to navigation
Jump to search
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+)/i ) { + 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.
You may also want to add this patch which includes some rudimentary instructions for users
+++ share/html/Search/Simple.html 2008-09-08 13:21:17.000000000 -0400 @@ -58,6 +58,8 @@ <p><&|/l&>Search for tickets. Enter <strong>id</strong> numbers, <strong>queues</strong> by name, Owners by <strong>username</strong> and Requestors by <strong>email address</strong>.</&></p> +<p><&|/l&>Searching custom field values can be done, though it may take a long time if other constraints are not applied. To do so, search with <b>.CFName:<i>word</i></b>. e.g; <tt>.tags:spam</tt></&></p> + <p><&|/l&>Searching the full text of every ticket can take a long time, but if you need to do it, you can search for any word in full ticket history for any word by typing <b>fulltext:<i>word</i></b>.</&></p> <p><&|/l&>RT will look for anything else you enter in ticket subjects.</&></p>
OR, you might install RTx:Tags, which provides this functionality and more, sans patches.