[Rt-devel] Query Builder messing up alternative conditions

Allen allen+rtlist at crystalfontz.com
Mon Aug 17 15:29:45 EDT 2009


I have noticed that when we ask QueryBuilder to search 'Content' for
THIS "OR" THAT, it actually ends up  executing SQL that searches for
one condition "THIS AND THAT," causing us to incorrectly get no
results.

For example, TicketSQL (put together using RT's Query Builder search
criteria select form, and then verified in the "Advanced" window:

    Content LIKE 'foo' OR Content LIKE 'FOO'

I find in logs executed as (incorrect "AND" aggregator that should
have been "OR" marked with "--->")

[Mon Aug 17 19:07:23 2009] [debug]: SQL(0.000164s):
SELECT COUNT(DISTINCT main.id)
FROM Tickets main
JOIN Transactions Transactions_1  ON ( Transactions_1.ObjectId = main.id )
JOIN Attachments Attachments_2  ON ( Attachments_2.TransactionId =
Transactions_1.id )
WHERE (Transactions_1.ObjectType = 'RT::Ticket')
	AND (main.Status != 'deleted')
	AND (
			( Attachments_2.Filename IS NULL AND Attachments_2.Content LIKE '%foo%' )
--->			AND
			( Attachments_2.Filename IS NULL AND Attachments_2.Content LIKE '%FOO%' )
		)
	AND (main.Type = 'ticket')
	AND (main.EffectiveId = main.id) ;
(/usr/share/request-tracker3.8/html/autohandler:331)

Does anyone know if this is a bug in RT or in DBx::SearchBuilder? This
problem is really crippling for searching when combined with the fact
that all ticket Content is stored in a MySQL BLOB field which causes
searches to be case-sensitive.

This means users will never find a ticket that contains "Foo" in the
body if they only searched for "foo" (lowercase). And they will never
find it if they try to search for both cases at once in Query Builder
because this bug ANDs the conditions together, requiring both forms to
be present instead of just one.

What can be done to get around this and let people find tickets that
contain "Foo" when they search for "foo" ?

I am on Ubuntu Server 09.04
RT 3.8.4 installed from Ubuntu Karmic package
libdbix-searchbuilder-perl 1.55 package

I also posted this at http://rt3.fsck.com/Ticket/Display.html?id=13775
but don;t know if it is really RT's problem or not, and still would
like to know if there is a workaround.

Allen


More information about the Rt-devel mailing list