Package org.exist.indexing

Examples of org.exist.indexing.StructuralIndex


        // ones
//        if (currentSet == null
//            || currentDocs == null
//            || (!optimized && !(docs == currentDocs || docs
//                .equalDocs(currentDocs)))) {
          final StructuralIndex index = context.getBroker().getStructuralIndex();
          if (context.getProfiler().isEnabled())
            {context.getProfiler().message(
                this,
                Profiler.OPTIMIZATIONS,
                "OPTIMIZATION",
                "Using structural index '" + index.toString()
                    + "'");}
          return index.matchElementsByTagName(
              ElementValue.ELEMENT, docs, test.getName(), null);
//          currentDocs = docs;
//UNDERSTAND: TODO:          registerUpdateListener();
        }
//        return currentSet.selectParentChild(contextSet,
//            NodeSet.DESCENDANT, contextId);
//      }
    } else {
      final DocumentSet docs = getDocumentSet(contextSet);
      final StructuralIndex index = context.getBroker().getStructuralIndex();
      if (context.getProfiler().isEnabled())
        {context.getProfiler().message(this, Profiler.OPTIMIZATIONS,
            "OPTIMIZATION",
            "Using structural index '" + index.toString() + "'");}
      if (contextSet instanceof ExtNodeSet
          && !contextSet.getProcessInReverseOrder()) {
        return index.matchDescendantsByTagName(ElementValue.ELEMENT,
            test.getName(), axis, docs, (ExtNodeSet) contextSet,
            contextId);
      } else {
        // if (contextSet instanceof VirtualNodeSet)
        // ((VirtualNodeSet)contextSet).realize();
        final NodeSelector selector = new ChildSelector(contextSet, contextId);
        return index.matchElementsByTagName(ElementValue.ELEMENT, docs,
            test.getName(), selector);
      }
    }
  }
View Full Code Here


      synchronized (context) {
        if (currentSet == null
            || currentDocs == null
            || (!optimized && !(docs == currentDocs || docs
                .equalDocs(currentDocs)))) {
          final StructuralIndex index = context.getBroker().getStructuralIndex();
          if (context.getProfiler().isEnabled())
            {context.getProfiler().message(
                this,
                Profiler.OPTIMIZATIONS,
                "OPTIMIZATION",
                "Using structural index '" + index.toString()
                    + "'");}
          // TODO : why a null selector here ? We have one below !
          currentSet = index.findElementsByTagName(
              ElementValue.ATTRIBUTE, docs, test.getName(), null, this);
          currentDocs = docs;
          registerUpdateListener();
        }
        switch (axis) {
        case Constants.ATTRIBUTE_AXIS:
          return currentSet.matchParentChild(contextSet,
              NodeSet.DESCENDANT, contextId);
        case Constants.DESCENDANT_ATTRIBUTE_AXIS:
          return currentSet.matchAncestorDescendant(contextSet,
              NodeSet.DESCENDANT, false, contextId, true);
        default:
          throw new IllegalArgumentException(
              "Unsupported axis specified");
        }
      }
    } else {
      final DocumentSet docs = getDocumentSet(contextSet);
      final StructuralIndex index = context.getBroker().getStructuralIndex();
      if (context.getProfiler().isEnabled())
        {context.getProfiler().message(this, Profiler.OPTIMIZATIONS,
            "OPTIMIZATION",
            "Using structural index '" + index.toString() + "'");}
      if (contextSet instanceof ExtNodeSet
          && !contextSet.getProcessInReverseOrder()) {
        return index.matchDescendantsByTagName(ElementValue.ATTRIBUTE,
            test.getName(), axis, docs, (ExtNodeSet) contextSet,
            contextId);
      } else {
        NodeSelector selector;
        switch (axis) {
        case Constants.ATTRIBUTE_AXIS:
          selector = new ChildSelector(contextSet, contextId);
          break;
        case Constants.DESCENDANT_ATTRIBUTE_AXIS:
          selector = new DescendantSelector(contextSet, contextId);
          break;
        default:
          throw new IllegalArgumentException(
              "Unsupported axis specified");
        }
        return index.matchElementsByTagName(ElementValue.ATTRIBUTE,
            docs, test.getName(), selector);
      }
    }
  }
View Full Code Here

    /**
     * Realize the node set by scanning the structural index.
     * This is usually cheaper than calling {@link #getNodes()}.
     */
    private NodeSet getNodesFromIndex() {
        final StructuralIndex index = broker.getStructuralIndex();
        final byte type = test.getType() == Type.ELEMENT ? ElementValue.ELEMENT : ElementValue.ATTRIBUTE;
        final NodeSet result = index.scanByType(type, axis, test, useSelfAsContext && inPredicate,
            context.getDocumentSet(), context, contextId);
        realDocumentSet = result.getDocumentSet();
        return result;
    }
View Full Code Here

                        true, contextId, true);
                } else {
//                    NodeSelector selector;
                    final long start = System.currentTimeMillis();
//                    selector = new AncestorSelector(selection, contextId, true, false);
                    final StructuralIndex index = context.getBroker().getStructuralIndex();
                    final QName ancestorQN = contextStep.getTest().getName();
                    if (optimizables[current].optimizeOnSelf()) {
                        ancestors = index.findAncestorsByTagName(ancestorQN.getNameType(), ancestorQN, Constants.SELF_AXIS,
                            selection.getDocumentSet(), selection, contextId);
                    } else {
                        ancestors = index.findAncestorsByTagName(ancestorQN.getNameType(), ancestorQN,
                            optimizables[current].optimizeOnChild() ? Constants.PARENT_AXIS : Constants.ANCESTOR_SELF_AXIS,
                            selection.getDocumentSet(), selection, contextId);
                    }
                    if (LOG.isTraceEnabled()) {
                        LOG.trace("Ancestor selection took " + (System.currentTimeMillis() - start));
View Full Code Here

TOP

Related Classes of org.exist.indexing.StructuralIndex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.