[rt-users] Can Simple.html search Email OR Content (not AND) ?

allen+rtlist at crystalfontz.com allen+rtlist at crystalfontz.com
Thu May 21 13:27:49 EDT 2009


Hi,

I would like to make it so that the Simple Search (3.8.2) will always
search Content, Requestor and Subject fields using LIKE comparisons so
that users won't need  to prepend "fulltext:" and "email:" (the latter
won't find partial email addresses) on search terms.

I have created a local overlay for html/Search/Simple.html which loads
a local lib/RT/Search/Googleish.pm and that has an altered QueryToSQL
function which bakes the search term into the pseudo-SQL:

    ( Content LIKE 'munchy' ) OR ( Requestor LIKE 'munchy' ) OR (
Subject LIKE 'munchy' )

The above gets fed deeper into RT SearchBuilder guts, until it comes
out in the mysql query log as this:

1    WHERE (Transactions_1.ObjectType = 'RT::Ticket')
2        AND (main.Status != 'deleted')
3        AND (Users_5.EmailAddress LIKE '%munchy%')
4        AND (
5                    (  ( Attachments_2.Content LIKE '%munchy%' )  )
6                    OR
7                    (  ( CachedGroupMembers_4.id IS NOT NULL )  )
8                    OR
9                    ( main.Subject LIKE '%munchy%' )
10              )
11      AND (main.Type = 'ticket')
12      AND (main.EffectiveId = main.id)

So the final actual query is not what I asked for because there will
be zero results if the EmailAddress does not match. I want all results
where the Email OR Content OR Subject is LIKE the search term. If Line
3 above could be moved down after Line 4 and connected by "OR" then it
would work and find tickets.

I dug around and found something about EnteryAggregator in
lib/RT/Tickets_Overlay.pm but I don't know what to do next or how to
modify Googleish.pm to get the results I am looking for.

A



More information about the rt-users mailing list