예제 #1
0
 /**
  * {@inheritDoc}
  *
  * <p>The outer query hits loop contains the ancestor nodes.
  */
 public ScoreNode[][] getMatchingScoreNodes(ScoreNode ancestor) throws IOException {
   try {
     Path ancestorPath = hmgr.getPath(ancestor.getNodeId());
     PathBuilder builder = new PathBuilder(ancestorPath);
     builder.addAll(relPath.getElements());
     return contextIndex.getScoreNodes(builder.getPath().getNormalizedPath());
   } catch (RepositoryException e) {
     // ignore, probably does not exist anymore
     return null;
   }
 }
예제 #2
0
 /**
  * Creates a new child node join condition.
  *
  * @param parent the inner query hits.
  * @param reader the index reader.
  * @param resolver the hierarchy resolver.
  * @param condition the QOM child node join condition.
  * @throws IOException if an error occurs while reading from the index.
  */
 public ChildNodeJoin(
     MultiColumnQueryHits parent,
     IndexReader reader,
     HierarchyResolver resolver,
     ChildNodeJoinConditionImpl condition)
     throws IOException {
   super(parent);
   this.reader = reader;
   this.resolver = resolver;
   int idx = getIndex(parent, condition.getParentSelectorQName());
   ScoreNode[] nodes;
   while ((nodes = parent.nextScoreNodes()) != null) {
     Integer docNum = nodes[idx].getDoc(reader);
     parentIndex.addScoreNodes(docNum, nodes);
   }
 }
예제 #3
0
 /**
  * Creates an ancestor path node join.
  *
  * @param context the inner query hits.
  * @param contextSelectorName the selector name for the inner query hits.
  * @param relPath the relative path of the join condition.
  * @param hmgr the hierarchy manager of the workspace.
  * @throws IOException if an error occurs while reading from the index.
  */
 public AncestorPathNodeJoin(
     MultiColumnQueryHits context, Name contextSelectorName, Path relPath, HierarchyManager hmgr)
     throws IOException {
   super(context);
   this.hmgr = hmgr;
   this.relPath = relPath;
   int idx = getIndex(context, contextSelectorName);
   ScoreNode[] nodes;
   while ((nodes = context.nextScoreNodes()) != null) {
     try {
       Path p = hmgr.getPath(nodes[idx].getNodeId());
       contextIndex.addScoreNodes(p, nodes);
     } catch (RepositoryException e) {
       // ignore
     }
   }
 }
예제 #4
0
 /**
  * {@inheritDoc}
  *
  * <p>The outer query hits loop contains the child nodes.
  */
 public ScoreNode[][] getMatchingScoreNodes(ScoreNode child) throws IOException {
   docNums = resolver.getParents(child.getDoc(reader), docNums);
   tmpScoreNodes.clear();
   for (int docNum : docNums) {
     ScoreNode[][] sn = parentIndex.getScoreNodes(docNum);
     if (sn != null) {
       for (ScoreNode[] aSn : sn) {
         tmpScoreNodes.add(aSn);
       }
     }
   }
   if (tmpScoreNodes.isEmpty()) {
     return null;
   } else {
     return tmpScoreNodes.toArray(new ScoreNode[tmpScoreNodes.size()][]);
   }
 }