On Sep 27, 2011, at 22:39 , Jukka Zitting wrote: > Hi Lukas, > > On Tue, Sep 27, 2011 at 10:20 PM, Lukas Kahwe Smith <[email protected]> > wrote: >> I am wondering how to do a search given the following >> >> /foo/bar (UUID 1234, property "lala" is "huii") >> /ding/dong (referencing UUID 1234) >> >> now I want to do a search limited to children of "/ding" but when >> searching I want it to search the contents of referenced nodes. > > As you noticed, references are not automatically followed by the query > engine. What you can do instead is to use a join query like this: > > SELECT dst.* > FROM [nt:base] AS src > JOIN [nt:unstructured] AS dst ON src.[reference] = dst.[jcr:uuid] > WHERE ISCHILDNODE(src, '/ding') AND dst.lala = 'huii'
I see but what about still being able to match with the same query? /ding/booo (property "lala" is "huii") i guess then i need to do a LEFT JOIN, which will likely put another dent on the performance, but i guess thats the price of references. regards, Lukas Kahwe Smith [email protected]
