code: public boolean needsSystemTree() {
  
          LocationStepQueryNode[] pathSteps = getPathSteps();
          if (pathSteps == null || pathSteps.length == 0) {
              return true;
          }
  
          InternalQName firstPathStepName = pathSteps[0].getNameTest();
          if (firstPathStepName == null) {
              // If the first operand of the path steps is a node type query
              // we do not need to include the system index if the node type is
              // none of the node types that may occur in the system index.
              QueryNode[] pathStepOperands = pathSteps[0].getOperands();
              if (pathStepOperands.length > 0) {
                  if (pathStepOperands[0] instanceof NodeTypeQueryNode) {
                      NodeTypeQueryNode nodeTypeQueryNode = (NodeTypeQueryNode) pathStepOperands[0];
                      if (!validJcrSystemNodeTypeNames.contains(nodeTypeQueryNode.getValue())) {
                          return false;
                      }
                  }
              }
              // If the first location step has a null name test we need to include
              // the system tree ("*")
              return true;
          }
  
          // Calculate the first workspace relative location step
          LocationStepQueryNode firstWorkspaceRelativeStep = pathSteps[0];
          if (firstPathStepName.equals(Constants.ROOT_PATH.getName())){
              // path starts with "/jcr:root"
              if (pathSteps.length > 1) {
                  firstWorkspaceRelativeStep = pathSteps[1];
              }
          }
  
          // First path step starts with "//"
          if (firstWorkspaceRelativeStep.getIncludeDescendants()) {
              return true;
          }
  
          // If the first workspace relative location step is jcr:system we need
          // to include the system tree
          InternalQName firstWorkspaceRelativeName = firstWorkspaceRelativeStep.getNameTest();
          if (firstWorkspaceRelativeName == null
                  || firstWorkspaceRelativeName.equals(Constants.JCR_SYSTEM)) {
              return true;
          }
  
          return super.needsSystemTree();
      }
docs: {@inheritDoc}