Details
Description
Very complex queries can cause take a long time to parse, and can possibly cause OOME. It would be good if processing queries automatically stops after some number of loops, after some time, or some amount of memory was used. And then throw an exception "query too complex".
Example query:
//element(*,rep:Authorizable)[ ( ( jcr:like(fn:lower-case(fn:name()), 'audio%') or jcr:contains(@rep:principalName,'audio*') or jcr:contains(@cq:first-name,'audio*') or jcr:contains(@cq:last-name,'audio*') or jcr:contains(profile/@givenName,'audio*') or jcr:contains(profile/@familyName,'audio*') ) and ( jcr:like(fn:lower-case(fn:name()), 'conference%') or jcr:contains(@rep:principalName,'conference*') or jcr:contains(@cq:first-name,'conference*') or jcr:contains(@cq:last-name,'conference*') or jcr:contains(profile/@givenName,'conference*') or jcr:contains(profile/@familyName,'conference*') ) and ( jcr:like(fn:lower-case(fn:name()), 'details:%') or jcr:contains(@rep:principalName,'details:*') or jcr:contains(@cq:first-name,'details:*') or jcr:contains(@cq:last-name,'details:*') or jcr:contains(profile/@givenName,'details:*') or jcr:contains(profile/@familyName,'details:*') ) and ( jcr:like(fn:lower-case(fn:name()), 'conference%') or jcr:contains(@rep:principalName,'conference*') or jcr:contains(@cq:first-name,'conference*') or jcr:contains(@cq:last-name,'conference*') or jcr:contains(profile/@givenName,'conference*') or jcr:contains(profile/@familyName,'conference*') ) and ( jcr:like(fn:lower-case(fn:name()), 'code:%') or jcr:contains(@rep:principalName,'code:*') or jcr:contains(@cq:first-name,'code:*') or jcr:contains(@cq:last-name,'code:*') or jcr:contains(profile/@givenName,'code:*') or jcr:contains(profile/@familyName,'code:*') ) and ( jcr:like(fn:lower-case(fn:name()), '123456%') or jcr:contains(@rep:principalName,'123456*') or jcr:contains(@cq:first-name,'123456*') or jcr:contains(@cq:last-name,'123456*') or jcr:contains(profile/@givenName,'123456*') or jcr:contains(profile/@familyName,'123456*') ) and ( jcr:like(fn:lower-case(fn:name()), 'further%') or jcr:contains(@rep:principalName,'further*') or jcr:contains(@cq:first-name,'further*') or jcr:contains(@cq:last-name,'further*') or jcr:contains(profile/@givenName,'further*') or jcr:contains(profile/@familyName,'further*') ) and ( jcr:like(fn:lower-case(fn:name()), 'dial%') or jcr:contains(@rep:principalName,'dial*') or jcr:contains(@cq:first-name,'dial*') or jcr:contains(@cq:last-name,'dial*') or jcr:contains(profile/@givenName,'dial*') or jcr:contains(profile/@familyName,'dial*') ) and ( jcr:like(fn:lower-case(fn:name()), 'in%') or jcr:contains(@rep:principalName,'in*') or jcr:contains(@cq:first-name,'in*') or jcr:contains(@cq:last-name,'in*') or jcr:contains(profile/@givenName,'in*') or jcr:contains(profile/@familyName,'in*') ) and ( jcr:like(fn:lower-case(fn:name()), 'numbers:%') or jcr:contains(@rep:principalName,'numbers:*') or jcr:contains(@cq:first-name,'numbers:*') or jcr:contains(@cq:last-name,'numbers:*') or jcr:contains(profile/@givenName,'numbers:*') or jcr:contains(profile/@familyName,'numbers:*') ) and ( jcr:like(fn:lower-case(fn:name()), 'http://wikipedia.org%') or jcr:contains(@rep:principalName,'http://wikipedia.org*') or jcr:contains(@cq:first-name,'http://wikipedia.org*') or jcr:contains(@cq:last-name,'http://wikipedia.org*') or jcr:contains(profile/@givenName,'http://wikipedia.org*') or jcr:contains(profile/@familyName,'http://wikipedia.org*') ) and ( jcr:like(fn:lower-case(fn:name()), 'conference%') or jcr:contains(@rep:principalName,'conference*') or jcr:contains(@cq:first-name,'conference*') or jcr:contains(@cq:last-name,'conference*') or jcr:contains(profile/@givenName,'conference*') or jcr:contains(profile/@familyName,'conference*') ) and ( jcr:like(fn:lower-case(fn:name()), 'number(s):%') or jcr:contains(@rep:principalName,'number(s):*') or jcr:contains(@cq:first-name,'number(s):*') or jcr:contains(@cq:last-name,'number(s):*') or jcr:contains(profile/@givenName,'number(s):*') or jcr:contains(profile/@familyName,'number(s):*') ) and ( jcr:like(fn:lower-case(fn:name()), 'emea:%') or jcr:contains(@rep:principalName,'emea:*') or jcr:contains(@cq:first-name,'emea:*') or jcr:contains(@cq:last-name,'emea:*') or jcr:contains(profile/@givenName,'emea:*') or jcr:contains(profile/@familyName,'emea:*') ) and ( jcr:like(fn:lower-case(fn:name()), '%') or jcr:contains(@rep:principalName,'*') or jcr:contains(@cq:first-name,'*') or jcr:contains(@cq:last-name,'*') or jcr:contains(profile/@givenName,'*') or jcr:contains(profile/@familyName,'*') ) and ( jcr:like(fn:lower-case(fn:name()), 'test%') or jcr:contains(@rep:principalName,'test*') or jcr:contains(@cq:first-name,'test*') or jcr:contains(@cq:last-name,'test*') or jcr:contains(profile/@givenName,'test*') or jcr:contains(profile/@familyName,'test*') ) and ( jcr:like(fn:lower-case(fn:name()), 'to%') or jcr:contains(@rep:principalName,'to*') or jcr:contains(@cq:first-name,'to*') or jcr:contains(@cq:last-name,'to*') or jcr:contains(profile/@givenName,'to*') or jcr:contains(profile/@familyName,'to*') ) and ( jcr:like(fn:lower-case(fn:name()), 'join%') or jcr:contains(@rep:principalName,'join*') or jcr:contains(@cq:first-name,'join*') or jcr:contains(@cq:last-name,'join*') or jcr:contains(profile/@givenName,'join*') or jcr:contains(profile/@familyName,'join*') ) and ( jcr:like(fn:lower-case(fn:name()), 'the%') or jcr:contains(@rep:principalName,'the*') or jcr:contains(@cq:first-name,'the*') or jcr:contains(@cq:last-name,'the*') or jcr:contains(profile/@givenName,'the*') or jcr:contains(profile/@familyName,'the*') ) and ( jcr:like(fn:lower-case(fn:name()), 'meeting:%') or jcr:contains(@rep:principalName,'meeting:*') or jcr:contains(@cq:first-name,'meeting:*') or jcr:contains(@cq:last-name,'meeting:*') or jcr:contains(profile/@givenName,'meeting:*') or jcr:contains(profile/@familyName,'meeting:*') ) and ( jcr:like(fn:lower-case(fn:name()), 'http://wikipedia.org%') or jcr:contains(@rep:principalName,'http://wikipedia.org*') or jcr:contains(@cq:first-name,'http://wikipedia.org*') or jcr:contains(@cq:last-name,'http://wikipedia.org*') or jcr:contains(profile/@givenName,'http://wikipedia.org*') or jcr:contains(profile/@familyName,'http://wikipedia.org*') ) ) ] order by @rep:principalName