[rt-users] Adding (by default) custom field to the simple search
Christian Loos
cloos at netcologne.de
Thu Jan 15 10:32:15 EST 2015
Hi,
add on top of the file this lines:
package RT::Search::Simple;
use strict;
use warnings;
no warnings 'redefine';
Chris
Am 15.01.2015 um 16:14 schrieb Daniel Schwager:
> 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;
>
>
>
More information about the rt-users
mailing list