Monday, 15 June 2015

cq5 - Creating a search query with wildcard in SQL2 -



cq5 - Creating a search query with wildcard in SQL2 -

i've got request search, using wildcard.

i created next query

select * [nt:base] p isdescendantnode(p, [/home/users/ldap/2]) , p.[sling:resourcetype] = 'cq/security/components/profile' , contains (p.memberof, 'sug-pilot-anna')

and works expected. task of query users, fellow member of particular ldap group.

because there lot of work search every single group,

sug-pilot-anna sug-pilot-berta sug-pilot-ceta

, easier , more efficient utilize wildcard. according serveral documantations, like operator supported sql2.

my question is: how looks query wildcard?

thanks help/idears.

you can utilize % wildcard , query requirements.

select * [nt:base] p isdescendantnode(p, [/home/users/ldap/2]) , p.[sling:resourcetype] = 'cq/security/components/profile' , p.memberof 'sug-pilot-%'

this homecoming list of users belong grouping name starting sug-pilot-. '%' matches 0 or more characters , '_' matches 1 character.

the exact query working in instance was

select * [nt:base] p isdescendantnode(p, [/home/users/]) , p.[sling:resourcetype] = 'cq/security/components/profile' , p.memberof '%de%'

cq5 jcr jcr-sql2

No comments:

Post a Comment