code: @SuppressWarnings("unchecked")
      public <T> T reducePreOrder(QueryReducer<T> queryReducer, T initialValue) {
          // compiler hack to make acc final and mutable :-)
          final Object[] acc = {initialValue};
          visitPreOrder(new QueryVisitorStub() {
              @Override
              public void visitField(QueryVisitorFieldEnvironment env) {
                  acc[0] = queryReducer.reduceField(env, (T) acc[0]);
              }
          });
          return (T) acc[0];
      }
docs: Reduces the fields of a Document (or parts of it) to a single value. The fields are visited in pre-order.
  
  @param queryReducer the query reducer
  @param initialValue the initial value to pass to the reducer
  @param <T>          the type of reduced value
  
  @return the calucalated overall value