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

Ruslan Zakirov ruslan.zakirov at gmail.com
Thu May 21 14:19:39 EDT 2009


This known issue that if email is not in the db then result would be
empty even if condition is ORed with another, but believe me correct
query will kick breath out of your DB server.

On Thu, May 21, 2009 at 9:27 PM,  <allen+rtlist at crystalfontz.com> wrote:
> 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
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>



-- 
Best regards, Ruslan.



More information about the rt-users mailing list