Torben Nehmer wrote:
Hi everybody,
is there a simple way to filter all resolved ticket from searches done through the simple search feature? I often use that feature to do a quick "fulltext:this-and-that", and the buch of resolved tickets I get there sort of clutters up the result list.

After running a SimpleSearch, you can click on 'Query Builder', which will load the last query you have run (the SimpleSearch) and allow you to modify it from there (like to remove resolved tickets). If you often run SimpleSearch queries that you wish to restrict to unresolved tickets, there are a few customization options available that may save you much time. You could make SimpleSearch only search for unresolved Tickets by editing html/Search/Simple.html , or, perhaps make a SelectBox in html/Elements/SimpleSearch with options for 'Unresolved' and 'All', and add code in html/Search/Simple.html to add the that ARG to the query. I've done something similar to the latter in my AssetTracker SimpleSearch. I've attached my diff, in case it helps.

Ryan



--- share/html/AssetTracker/Elements/SimpleSearch       Wed Dec 13 08:40:03 2006
+++ local/html/AssetTracker/Elements/SimpleSearch       Wed Jan 17 14:13:26 2007
@@ -45,5 +45,12 @@
 %# END BPS TAGGED BLOCK }}}
 <form action="<% $RT::WebPath %>/AssetTracker/index.html">
 <input size="12" name="q" autocomplete="off" accesskey="0">
-<input type="submit" value="<&|/l&>Search</&>">&nbsp;
+<input type="submit" class="button" value="<&|/l&>Find Assets</&>">&nbsp;
+<select name="qtype">
+<option>
+<option value="UFnet">by UFnet
+<option value="serial">by serial
+<option value="mac">by MAC
+</select>
+&nbsp;
 </form>
--- share/html/AssetTracker/index.html  Wed Dec 13 08:40:07 2006
+++ local/html/AssetTracker/index.html  Wed Jan 17 14:16:22 2007
@@ -27,23 +27,37 @@
 if ( $ARGS{'q'} ) {
     my $query = $ARGS{'q'};
 
+    $query =~ s/<[B|b][R|r]>$//;
+
     if ( $query =~ m/^(\d+\.\d+\.\d+\.\d+)$/ ) {
         $m->comp("/AssetTracker/Search/Results.html", Query => "IP = 
'$query'", AutoForwardSingleResult => 1);
         return();
     }
-    elsif ( $query =~ /^(\d+)$/ ) {
-        Abort("Don't know how to seach for ports (yet)");
-    }
 
     if ($m->comp('/Elements/Callback', _CallbackName => 'SearchPreFilter',
                  query => $query, %ARGS)) {
         return();
     }
 
-    $m->comp("/AssetTracker/Search/Results.html", Query => "Name LIKE '$query' 
AND Status != 'retired'", AutoForwardSingleResult => 1);
+    if ( $query =~ m/^([S|s|\d]\d\d\d-\d+)$/ ) {
+        $m->comp("/AssetTracker/Search/Results.html", Query => "(Name LIKE 
'$query') AND Status != 'retired'", AutoForwardSingleResult => 1);
+        return();
+    }
+
+    if ($ARGS{'qtype'} eq 'UFnet') {
+      $m->comp("/AssetTracker/Search/Results.html", Query => "'CF.{UFnet}' 
LIKE '$query' AND Status != 'retired'", AutoForwardSingleResult => 1);
+    } elsif ($ARGS{'qtype'} eq 'serial') {
+      $m->comp("/AssetTracker/Search/Results.html", Query => "'CF.{Serial}' 
LIKE '$query' AND Status != 'retired'", AutoForwardSingleResult => 1);
+    } elsif ($ARGS{'qtype'} eq 'mac') {
+      $m->comp("/AssetTracker/Search/Results.html", Query => "MAC LIKE 
'$query' AND Status != 'retired'", AutoForwardSingleResult => 1);
+    } else {
+      $m->comp("/AssetTracker/Search/Results.html", Query => "Name LIKE 
'$query' AND Status != 'retired'", AutoForwardSingleResult => 1);
+    }
+    #$m->comp("/AssetTracker/Search/Results.html", Query => "(Name LIKE 
'$query') AND Status != 'retired'", AutoForwardSingleResult => 1);
     return();
 
 }
+
 
 
 if ($ARGS{'HomeRefreshInterval'}) {
begin:vcard
fn:Ryan Fox
n:Fox;Ryan
org:The University of Findlay;Information Technology Services
adr:21 Old Main;;1000 Main St;Findlay;OH;45840;USA
email;internet:[EMAIL PROTECTED]
title:Network Services Manager
tel;work:419-434-4348
x-mozilla-html:TRUE
version:2.1
end:vcard

_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to