[rt-users] help with ModifyQuery callback

Izz Abdullah Izz.Abdullah at hibbett.com
Thu Oct 13 09:40:51 EDT 2011


1. This was within a 'simple perl program' outside of RT.  I already answered what happens: print $$query results in undefined variable error (because using strict). print $query prints "search term".  This is completely independent from ModifyQuery, and as I said, I have tried using BOTH $query and $$query in ModifyQuery and it is not working, in fact SimpleSearch quits working altogether.  I got the code from places in the wiki which automagically double scalars.  I have done the same thing with the SkipTransaction Callback and it works.
http://requesttracker.wikia.com/wiki/SimpleSearchExcludeResolved
and you didn't have anything to say in this user's request on why it doesn't do anything either:
http://www.gossamer-threads.com/lists/rt/users/98262
which also touches on the $RT::Logger not working in his callback, if I could get that to work, I wouldn't be bothering everyone here.
2. Management wants it this way...they are not going to be searching for queue:General or using any other nice utilities you have put into RT, if they were, they wouldn't mind type fulltext: before the search term.
3. I'll look at the Googleish.pm, but I bet I will have just as many questions...hopefully not.  I was putting this in a callback to avoid any conflicts in patching the RT app in the future.


-----Original Message-----
From: rt-users-bounces at lists.bestpractical.com [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Kevin Falcone
Sent: Wednesday, October 12, 2011 5:38 PM
To: rt-users at lists.bestpractical.com
Subject: Re: [rt-users] help with ModifyQuery callback

On Wed, Oct 12, 2011 at 03:41:58PM -0500, Izz Abdullah wrote:
> And I have tried with just $query...I wrote the silly program though 
> and received what I expected, an error for an undefined variable.  If 
> I change the print line to print $query;

If print $query works, why are you using $$query on the right of an assignment?  go print $$query and see what you get.

> I have been using the double $ because that is all I could find on the net...no one here has given me any other guidance on this issue.

The correct way to do this is to avoid hacking things onto the string (what happens when I use the syntax available to do queue:General, are you going to transform that to fulltext:queue:General?)

lib/RT/Search/Googleish.pm has been massively refactored and contains a number of small subroutines available for overriding that affect the way that the default parsing is done.  You could do this with in a much less fragile manner by looking at that code and overriding the default parsing one.

-kevin



More information about the rt-users mailing list