On Sep 27, 2011, at 22:47 , Lukas Kahwe Smith wrote:

> 
> 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.


speaking of JOIN, i ran into this issue before but getting a 403 Repository 
exception when I send a simple JOIN via davex:

<D:searchrequest xmlns:D="DAV:"><JCR-SQL2><![CDATA[SELECT * FROM 
[nt:unstructured] AS data INNER JOIN [nt:unstructured] AS referring ON 
referring.reference = data.[jcr:uuid] WHERE data.foo = 
'bar']]></JCR-SQL2></D:searchrequest>

so far the only JOIN's I have managed to send without an error are those that 
have zero results .. i fear it might be something with how i am constructing my 
davex queries. then again without a join everything works nicely. guess i will 
need to debug this with some co-workers during normal work hours ..

regards,
Lukas Kahwe Smith
[email protected]



Reply via email to