/** * @see org.xcmis.search.QueryObjectModelVisitor#visit(org.xcmis.search.model.constraint.DescendantNode) */ public void visit(DescendantNode node) throws VisitException { String parentPath = node.getAncestorPath(); if (parentPath.charAt(0) == '[') { //uuid based absolute path Query parentQuery = new TermQuery(new Term(FieldNames.UUID, parentPath.substring(1, parentPath.length() - 1))); Query childNodeQuery = new ChildTraversingQueryNode(parentQuery, true); queryBuilderStack.push(childNodeQuery); } else { final Object[] entries = pathSplitter.splitPath(parentPath); Query descendantQuery = new TermQuery(new Term(FieldNames.UUID, indexConfiguration.getRootUuid())); for (int i = 1; i < entries.length; i++) { final String stepName = nameConverter.convertName(entries[i]); final Query nameQuery = new TermQuery(new Term(FieldNames.LABEL, stepName)); descendantQuery = new DescendantQueryNode(nameQuery, descendantQuery); } // all childs descendantQuery = new ChildTraversingQueryNode(descendantQuery, true); queryBuilderStack.push(descendantQuery); } }
/** * {@inheritDoc} * * @see QueryObjectModelVisitor#visit(DescendantNode) */ public void visit(DescendantNode descendant) { append("ISDESCENDANTNODE("); append(descendant.getSelectorName()); append(','); append(descendant.getAncestorPath()); append(')'); }