[rt-users] RT3 - Custom Field search box in at a glance

Ruslan Zakirov ruz at bestpractical.com
Thu Jul 28 10:39:15 EDT 2011


On Thu, Jul 28, 2011 at 10:07 AM, Stijn Jonker <sjcjonker at sjc.nl> wrote:
> Ruslan & Others,
>
> On 27 Jul 2011, at 18:07, Ruslan Zakirov wrote:
>
>> Take a look into index.html where that input box is processed
>> initially. There is a callback to analyze string and implement custom
>> action.
>
> I did but, whatever I tried no success; I don't want to scream bug, but maybe call this an undocumented feature.. The issue is that I already modified the Googlish.pm module to add to the section:
>
>    for my $key (@keywords) {
>
>        # Is this a ticket number? If so, go to it.
>        # But look into subject as well
>        if ( $key =~ m/^\d+$/ ) {
>            push @id_clauses, "id = '$key'", "Subject LIKE '$key'", "CF.{ExtTicketId} LIKE '$key'";
>        }

This looks good. Did you spell CF name properly. Use quotes around
CF.{...} if name contains fancy characters.

> the "CF.{ExtTicketId} LIKE '$key'" item, but whatever I did when entering a numeric item it never found anything. Then I found in "Simple.html" the section:
>
> #    if ($q =~ /^#?(\d+)$/) {
> #        RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Ticket/Display.html?id=".$1);
> #    }

This part is special. If you enter plain number then RT just tries to
load the ticket. It works for most people. In your case you should
disable this bit and do something tricky.

Just clean mason cache, stop and start web server and it should work.

> So any search item entered which solely consists of digits is never searched for but always forces a ticket lookup, this without any fallback to the Googlish search. This also means the code in Googlish.pm is never executed.
>
> But correct me if I'm wrong or it's called from other locations where this is taken into account.

Googleish may be used in rt-crontool.

>> Want to note that RT4 has better abstraction of simple search and it's
>> easier to implement a new syntax there.
>
> I'm aware; however there is no port yet; and rather stay away from x.0 releases out of experience.

ok. Then you have to deal with whatever is in RT3.

-- 
Best regards, Ruslan.



More information about the rt-users mailing list