[rt-users] Adding (by default) custom field to the simple search

Daniel Schwager Daniel.Schwager at dtnet.de
Thu Jan 15 10:14:09 EST 2015


Hi,

I updated to 4.2.6 (from 3.8.8) in our lab - look fine. Now, I'm going to add some small customizations.

E.g. the simple Search (the search field in the web-ui on the top right) should also search for a custom field.
Therefore, I added an overlay /opt/rt4/local/lib/RT/Search/Simple_Local.pm with the content (1) - but it does not work.

It the file is parsed from RT, but the methods are not be called.

Is there something I missed ?

regards
Danny


(1) /opt/rt4/local/lib/RT/Search/Simple_Local.pm
# $_[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   {
    $RT::Logger->debug("dts-HandleDefault");
    my $fts = RT->Config->Get('FullTextSearch');
    if ($fts->{Enable} and $fts->{Indexed}) {
        return default => "(Subject LIKE '$_[1]' OR Content LIKE '$_[1]' OR 'CF.{CF-Customer}' LIKE '$_[1]')";
    } else {
        return default => "(Subject LIKE '$_[1]' OR 'CF.{CF-Customer}' LIKE '$_[1]' )";
    }
}

sub HandleSubject   { 
   $RT::Logger->debug("dts-HandleSubject"); 
   return subject   => "(Subject LIKE '$_[1]' OR  'CF.{CF-Customer}' LIKE '$_[1]')"; 
}

1;



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2279 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20150115/7c5fe308/attachment.bin>


More information about the rt-users mailing list