code: protected void addParentChildRelation(Document doc, String parentId) throws RepositoryException
     {
        doc.add(new Field(FieldNames.PARENT, parentId, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS,
           Field.TermVector.NO));
        //        NodeState parent = (NodeState) stateProvider.getItemState(parentId);
        //        ChildNodeEntry child = parent.getChildNodeEntry(node.getNodeId());
        //        if (child == null) {
        //            // this can only happen when jackrabbit
        //            // is running in a cluster.
        //            throw new RepositoryException(
        //                    "Missing child node entry for node with id: "
        //                    + node.getNodeId());
        //        }
        InternalQName name = node.getQPath().getName();
        addNodeName(doc, name.getNamespace(), name.getName());
     }
docs: Adds a parent child relation to the given <code>doc</code>.
  
  @param doc      the document.
  @param parentId the id of the parent node.
  @throws RepositoryException if the parent node does not have a child node
  entry for the current node.