code: private String getFulltextStatement(QueryRootNode aqt) throws RepositoryException
     {
        final String[] stmt = new String[1];
        aqt.accept(new TraversingQueryNodeVisitor()
        {
           @Override
           public Object visit(RelationQueryNode node, Object o) throws RepositoryException
           {
              if (stmt[0] == null && node.getOperation() == RelationQueryNode.OPERATION_SPELLCHECK)
              {
                 stmt[0] = node.getStringValue();
              }
              return super.visit(node, o);
           }
        }, null);
        return stmt[0];
     }
docs: Returns the fulltext statement of a spellcheck relation query node or
  <code>null</code> if none exists in the abstract query tree.
  
  @param aqt
  the abstract query tree.
  @return the fulltext statement or <code>null</code>.
  @throws RepositoryException