[rt-users] RT 4.2.9 Simple Search, Subject LIKE instead of Id =

Alex Vandiver alexmv at bestpractical.com
Mon Jan 19 20:41:05 EST 2015


On Mon, 19 Jan 2015 22:50:07 +0100 Vladimir Nikolic
<vladimir.nikolic at amis.net> wrote:
> Hello,
> 
> after upgrade to 4.2.9 (from 4.2.2), we noticed that Simple Search by 
> Ticket id doesn't work.
> If I enter 783509 in Search box, Edit Search shows sql query:
> 
> ( Subject LIKE 783502 ) AND (  Status = 'new' OR Status = 'open' OR 
> Status = 'resolved' OR Status = 'stalled' OR Status = 'rejected' OR 
> Status = 'deleted' )

This does not occur on a stock RT 4.2.9.

> /usr/local/lib/perl5/site_perl/RT/Search/Simple.pm has lines:
> 
>      # Assume that numbers were actually "default"s if we have other
>      # limits
>      if ($limits->{id} and keys %{$limits} > 1) {
>          my $values = delete $limits->{id};
>          for my $value (@{$values}) {
>              $value =~ /(\d+)/ or next;
>              my ($key, @tsql) = $self->HandleDefault($1);
>              push @{$limits->{$key}}, @tsql;
>          }
>      }
> 
> which rewrites 'Id =' to 'Subject LIKE'.

It only does so _if_ there are other limits -- as the comment
describes.  This is so, in a stock RT, entering «rt 4» into the search
box does not attempt to load ticket #4.


Double-check that you do not have any customizations in this area.  For
the following command, a stock RT 4.2.9 should return only the ID
clause:

perl -I/opt/rt4/lib -MRT=-init -MRT::Search::Simple \
 -le 'print RT::Search::Simple->new(TicketsObj =>
        RT::Tickets->new(RT->SystemUser))->QueryToSQL("783502")'


 - Alex



More information about the rt-users mailing list