[rt-users] RT 3.8.2 / Pg 8.3.5: Case-insensitive searching on custom fields not working?

Adam Tingle adamtingle at gmail.com
Fri Jan 23 22:09:16 EST 2009


When I do a search for a ticket subject or content, RT queries PostgreSQL
using the ILIKE operator and returns results on case-insensitive basis.
However, when I search for a custom field, RT queries the database using the
LIKE operator and returns results on a case-sensitive basis.

I've enabled the option log_statement = 'all' in postgresql.conf and see the
following output in postgresql-8.3-main.log.

Here is sample output from a search on ticket subject:

LOG:  statement: 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.Content ILIKE
'%searchterm%' )  ) ) AND (main.Type = 'ticket') AND (main.EffectiveId =
main.id)

Here is sample output from a search on a custom field:

LOG:  statement: SELECT COUNT(DISTINCT main.id) FROM Tickets main JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_1  ON (
ObjectCustomFieldValues_1.CustomField = '1' ) AND (
ObjectCustomFieldValues_1.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_1.Disabled = '0' ) AND (
ObjectCustomFieldValues_1.ObjectId = main.id )  WHERE (main.Status !=
'deleted') AND ( (  (  (  ( ObjectCustomFieldValues_1.Content LIKE
'%searchterm%' OR  (  ( ObjectCustomFieldValues_1.Content = '' OR
ObjectCustomFieldValues_1.Content IS NULL )  AND
ObjectCustomFieldValues_1.LargeContent LIKE '%searchterm%' )  )  )  )  ) )
AND (main.Type = 'ticket') AND (main.EffectiveId = main.id)

Is this a bug or expected results? I'd really like to have case-insensitive
search on CFs.

Thanks RT!

-- 
...................
Adam Tingle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090123/4896ecec/attachment.htm>


More information about the rt-users mailing list