AnsweredAssumed Answered

Adding children to store root

Question asked by hsjawanda on Feb 17, 2006
Latest reply on Mar 17, 2006 by soeursourire

I have been trying a few things, have been getting unexpected results, and now I am confused.  So here are my questions:

Is there anything special about adding a node (say, a folder) directly as a child of a store root? I have a store with protocol "workspace" – will the following code work for adding a folder directly under the store root:

// this.storeRef points to the store I am interested in.
NodeRef rootNode = nodeService.getRootNode(this.storeRef);

// Creating a folder as a direct child of storeRef
ChildAssociationRef childAssocRef = nodeService.createNode(rootNode,
        ContentModel.PROP_CONTAINS, QName.createQName(
                NamespaceService.CONTENT_MODEL_1_0_URI, folderName),

Does it matter whether I use ContentModel.PROP_CONTAINS or some other QName as the assocTypeQName when adding a child to a store's root?

What are the differences between creating child associations and creating plain-jane associations (NodeService#createAssociation())? I think one of the differences is that (recursive) searching under a parent node will search those nodes related through child associations, but not those related through plain associations – is this correct?

If I don't put any "PATH:" term in my Lucene search, does the whole store get searched? For example, if I construct a query like this:

String query = "+TYPE:\"" + ContentModel.TYPE_FOLDER.toString() + "\"";

will I get back a list of all the folders in the store being searched?  Will the assocTypeQName I use while adding children make a difference to the results of the above query?

I apologize for asking so many questions in a single post, but I am getting confused by some of the results I am seeing :-).