Mailing List Archive

simple search not finding words in subjects?
Hi all,
My boss said he couldn't find a ticket that he thought he should be able to
find. He was searching a customer name, let's say Custname. I thought at
first the problem was that the ticket was resolved, but I was wrong.

The problem appears to be that simple search is looking for "content like
"searchTerm"". When I changed it to "subject like "searchTerm"", the ticket
in question came right up.

I guess I need to set simple search to look for "content like "searchTerm"
OR subject like "searchTerm"". But I see no way to customize the simple
search query in the configuration options. Is this possible? If so, what's
the recommended way? In case it matters, we do have full text indexing on.
RT4.4.1 on Debian 8. Thanks!

--
Alex Hall
Automatic Distributors, IT department
ahall@autodist.com
Re: simple search not finding words in subjects? [ In reply to ]
On Wed, Nov 30, 2016 at 9:46 AM, Alex Hall <ahall@autodist.com> wrote:
> Hi all,
> My boss said he couldn't find a ticket that he thought he should be able to
> find. He was searching a customer name, let's say Custname. I thought at
> first the problem was that the ticket was resolved, but I was wrong.
>
> The problem appears to be that simple search is looking for "content like
> "searchTerm"". When I changed it to "subject like "searchTerm"", the ticket
> in question came right up.
>
> I guess I need to set simple search to look for "content like "searchTerm"
> OR subject like "searchTerm"". But I see no way to customize the simple
> search query in the configuration options. Is this possible?

Yes.

If so, what's
> the recommended way?

Use a callback. In fact, use this one:

Search/Simple.html/ModifyQuery

I don't see us using this callback in our current RT installation, but
here is the contents of our callback for our legacy (3.8) install. It
doesn't do what you are asking about, but it should give you a feel
for the callback.

cat /usr/local/share/request-tracker3.8/plugins/RT-Site-UMN-Duluth/html/Callbacks/RT-Site-UMN-Duluth/Search/Simple.html/ModifyQuery
<%INIT>
my %statuses;
if (RT->Config->Get("ActiveStatus")) {
%statuses = map { $_ => 1 } RT->Config->Get("ActiveStatus"); # Put
active statuses into our hash
}
if (RT->Config->Get("InactiveStatus")) {
%statuses = (map({ $_ => 1 } RT->Config->Get("InactiveStatus")),
%statuses); # Put inactive statuses into our hash
}

my $all_statuses = join "|", keys %statuses;

delete $statuses{rejected};
delete $statuses{deleted};
my $statuses_we_care_about = join " ", keys %statuses;
# if 'query' does not have a status word in the query or is not
strictly a number
# then prepend some statuses to the query
if ($$query !~ /\b(?:$all_statuses)\b|^\s*\d+\s*$/i ) {
$$query = "$statuses_we_care_about $$query";
}
</%INIT>
<%ARGS>
$query => undef
</%ARGS>

-m
---------
RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training
* Los Angeles - January 9-11 2017