Get unique page name(s) from the mentioned JCR-SQL2 query
Hi All,
We have a below JCR-SQL2 query as below :
SELECT DISTINCT Path FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/x/y]) AND (CONTAINS(s.[cq:tags],'ABC DEF^600') OR CONTAINS(s.blocktitle,'ABC DEF^400') OR (s.blocktitle LIKE 'ABC DEF%') OR CONTAINS(s.bodycopy,'ABC DEF^100') OR (s.bodycopy LIKE 'ABC DEF%') OR CONTAINS(s.headingText,'ABC DEF^10') OR (s.headingText LIKE 'ABC DEF%') OR CONTAINS(s.Author,'ABC DEF^400') OR (s.Author LIKE 'ABC DEF%') OR CONTAINS(s.headline,'ABC DEF^2') OR (s.headline LIKE 'ABC DEF%') OR CONTAINS(s.[jcr:title],'ABC DEF') OR (s.[jcr:title] LIKE 'ABC DEF%')) AND ( NOT [hideInSearch] IS NOT NULL) ORDER BY 'jcr:lastModified'
1] Most of the properties queried are present at jcr:content level of page and some of them are present at component level [for example : if a page has component c1, headingText property is present at the component level and not at the jcr:content level of the page ].
2] "ABC DEF" is the search keyword provided on the page
3] Suppose we have a page, with few components in it which satisfies the criteria, the result would be returned in the form of
/content/abc/def/jcr:content/component1
/content/abc/def/jcr:content/component2
/content/abc/def/jcr:content/component3
4] I would want this query to return just /content/abc/def instead of results given as in #3[i.e, even if several components in a page matches the criteria, at the end I just want that particular page to be returned, instead of seperate values ].
5] Can someone please let me know how this can be achieved.
Any thoughts/pointers on this will be really really helpful