jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: Node search based on children properties
Date Tue, 15 May 2007 07:18:37 GMT
Luca Tagliani wrote:
> Thanks Marcel!
> I have another question regarding search:
> 
> I follow your suggestion and model the document with nt:file (and
> nt:linkedFile) nodes.
> 
> Using the same example as before, if we tought to /Folder1/Document1 as
> nt:file and /Folder2/Document1 as nt:linkedFile, the query you wrote returns
> only the first folder.
> 
> How can I have returned both folders?

you need to search for nt:resource nodes and then expand the query result 
manually. jackrabbit currently does not support using the jcr:deref() function 
in the predicate of an XPath statement.

NodeIterator nodes = result.getNodes();
while (nodes.hasNext()) {
   for (PropertyIterator it = nodes.nextNode().getReferences(); it.hasNext(); ) {
     Node linkedFile = it.nextProperty().getParent();
     linkedFile.getPath();
     // ...
   }
}

regards
  marcel

Mime
View raw message