[rt-users] 'content matches' and 'content doesn't match' give same results

Joop jvdwege at xs4all.nl
Sat Aug 9 05:57:56 EDT 2014


On 9-8-2014 2:38, Alex Peters wrote:
>
> Values need to be quoted, I believe.  Compare these two queries:
>
> Content LIKE foo.com <http://foo.com>
> Content LIKE 'foo.com <http://foo.com>'
>
> I wonder whether wildcards might be necessary, like they seem to be in
> regular SQL:
>
> Content LIKE '%foo.com <http://foo.com>%'
>
> On 09/08/2014 12:36 am, "Jeff Blaine" <jblaine at kickflop.net
> <mailto:jblaine at kickflop.net>> wrote:
>
>     Setup: RT 4.2.5 with PostgreSQL and full-text indexing enabled
>     and completed for all tickets. Tickets 1, 2, and 3 all have
>     contents with the string foo.com <http://foo.com>
>
>     Searching for 'content LIKE foo.com <http://foo.com>' returns
>     tickets 1, 2, 3
>
>     Searching for 'content NOT LIKE foo.com <http://foo.com>' returns
>     tickets 1, 2, 3
>
>     Has anyone seen this? Any ideas what might be going wrong or how
>     do start debugging this?
>
>
I ran  a search with StatementLogging enabled and this is the sql
statement with "content not like 'foo.com'" and "content like
'foo.com'", they are the same.

SELECT COUNT(DISTINCT main.id) FROM Tickets main JOIN Transactions
Transactions_1  ON ( Transactions_1.ObjectType = 'RT::Ticket' ) AND (
Transactions_1.ObjectId = main.id ) JOIN Attachments Attachments_2  ON (
Attachments_2.TransactionId = Transactions_1.id )  WHERE (main.IsMerged
IS NULL) AND (main.Status != 'deleted') AND (main.Type = 'ticket') AND (
( Attachments_2.ContentIndex @@ plainto_tsquery('foo.com') ) ) ;

Seems the last AND should really be a AND NOT.

In the past SearchBuilder always pre and postpended % around search
terms. Not sure if it still does but I think so.

Joop

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140809/2170552e/attachment.htm>


More information about the rt-users mailing list