1 Reply Latest reply on Jun 28, 2013 9:46 AM by Yogesh Upadhyay

    SQL2 CONTAINS Clause

    Anoop_Kumar Level 1



      We have a requirement to exclude the pages from the search result list when the search keyword is not present in the content but is present in the tags.

      I am trying to implement this logic within the query itself but not able to identify a suitable condition for achieving the requirement.


      The nearest query I have is as below:

      SELECT * FROM [cq:PageContent] as queryResult

      WHERE ISDESCENDANTNODE('/content/bwpublic/en_gb')

      AND (CONTAINS(queryResult.*,'%keyword%') AND NOT CONTAINS([cq:tags],'%keyword%'))


      This query fails when the keyword is present both in the tag and content. I have noticed that usage of queryResult.* includes the tag content as well.

      Any inputs or ideas around this would be really helpful. I would also like to know if we can meet the requirement by implementing the logic outside the query.


      Thanks and Regards,

      Anoop Kumar