[Rt-devel] Re: Problem with the search in RTFM

Giulio Prinzi - Araknos Srl g.prinzi at araknos.it
Thu Feb 1 12:04:09 EST 2007


Hello,
I've done some modification trying to resolve my problem and now the
search by matching a text value in the custom field content seems to works.

Basically I've modified the ArticleCollection_Overlay.pm file by
including in the query a match in the
ObjectCustomFieldValues.LargeContent's content.

The resulting query looks like (I try to match the value "delta" in a CF
of all articles belonging to a fixed class ):

SELECT COUNT(DISTINCT main.id) FROM (FM_Articles main  LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_1  ON
((ObjectCustomFieldValues_1.CustomField = '6')) AND (
(ObjectCustomFieldValues_1.Disabled = '0')) AND ( 
ObjectCustomFieldValues_1.ObjectId = main.id))   WHERE ((main.Class =
'7')) AND ((ObjectCustomFieldValues_1.Content LIKE '%delta%') OR
(ObjectCustomFieldValues_1.LargeContent LIKE '%delta%'));

This query works well.. it seems.

Now the problem appears when performing a search by "Not Matching" a
text value in the custom field content.

Performing several test I've found that this query works:

SELECT COUNT(DISTINCT main.id) FROM (FM_Articles main  LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_1  ON
((ObjectCustomFieldValues_1.CustomField = '6')) AND
((ObjectCustomFieldValues_1.Content LIKE
'%delta%')OR(ObjectCustomFieldValues_1.LargeContent LIKE '%delta%')) AND
( (ObjectCustomFieldValues_1.Disabled = '0')) AND ( 
ObjectCustomFieldValues_1.ObjectId = main.id))   WHERE ((main.Class =
'7')) AND ((ObjectCustomFieldValues_1.Content IS
NULL)AND(ObjectCustomFieldValues_1.LargeContent IS NULL));

However I only  obtain a query like:

SELECT COUNT(DISTINCT main.id) FROM (FM_Articles main  LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_1  ON
((ObjectCustomFieldValues_1.CustomField = '6')) AND
((ObjectCustomFieldValues_1.Content LIKE
'%delta%')AND(ObjectCustomFieldValues_1.LargeContent LIKE '%delta%'))
AND ( (ObjectCustomFieldValues_1.Disabled = '0')) AND ( 
ObjectCustomFieldValues_1.ObjectId = main.id))   WHERE ((main.Class =
'7')) AND ((ObjectCustomFieldValues_1.Content IS
NULL)AND(ObjectCustomFieldValues_1.LargeContent IS NULL));


The question is:

how I can in the left join use differents entry aggregators
(AND+OR+AND..) instead of one?

Thanks for your help.

Giulio.


Giulio Prinzi - Araknos Srl wrote:
> Hi to all,
> I need help with an RTFM's problem that still make me insane..
> Seems that the search by matching (or not matching) content in a article's Custom Field dont'works as it should do..
>
> In particular I've found a problem related to the 'length' of the Custom Field's content: in the table ObjectCustomFieldValues there are two columns for containing the field's content (content and largecontent).
>
> However the search (how I can see in the file ArticleCollection_Overlay.pm) is performed only in the column content and so if I have a field containing a lot of text for example it will be ignored by the search that will return a wrong value.
>
> We run RT 3.6.0 and RTFM 2.2.0RC2 (svn 5150) on an ubuntu server 5.10 with postgresql 8.0.
>
> I've tryed also with the last RTFM's snapshot but I have the same problem.
>
> Thanks in advance for your help.
>
> Giulio.


More information about the Rt-devel mailing list