QueryResponseCollection[] collections = null; if ( value.getType() == Value.isNodeList ) collections = collectQueryInfo( scanResults( value.getNodeList() ) ); int resultSetId = sessions.addQueryResult( value ); resp.setCollections( collections ); resp.setHits( value.getNodeList().getLength() ); resp.setResultSetId( resultSetId ); resp.setQueryTime( System.currentTimeMillis() - start ); } catch ( Exception e ) { throw new RemoteException( "query execution failed: " + e.getMessage() ); } return resp; }
QueryResponseCollection[] collections = null; if (value.getType() == Value.isNodeList) collections = collectQueryInfo(scanResults(value.getNodeList())); session.addQueryResult(value); resp.setCollections(collections); resp.setHits(value.getNodeList().getLength()); resp.setQueryTime(System.currentTimeMillis() - start); } catch (Exception e) { throw new RemoteException("query execution failed: " + e.getMessage()); } return resp; }
    public org.exist.soap.QueryResponse query( java.lang.String query )         throws java.rmi.RemoteException {        if ( !( query.startsWith( "document(" ) ||            query.startsWith( "collection(" ) ) )            query = "document(*)" + query;        QueryResponse resp = new QueryResponse();        resp.setHits( 0 );        Sessions sessions = Sessions.getInstance();        try {            XPathLexer lexer = new XPathLexer( new StringReader( query ) );            XPathParser parser = new XPathParser( pool, new User( "admin", null, "dba" ), lexer );            PathExpr expr = new PathExpr(pool);            parser.expr( expr );            LOG.info( "query: " + expr.pprint() );            long start = System.currentTimeMillis();            if ( parser.foundErrors() )                throw new RemoteException( parser.getErrorMsg() );            DocumentSet ndocs = expr.preselect();            if ( ndocs.getLength() == 0 )                return resp;            Value value = expr.eval( ndocs, null, null );            QueryResponseCollection[] collections = null;            if ( value.getType() == Value.isNodeList )                collections = collectQueryInfo( scanResults( value.getNodeList() ) );            int resultSetId = sessions.addQueryResult( value );            resp.setCollections( collections );            resp.setHits( value.getNodeList().getLength() );            resp.setResultSetId( resultSetId );            resp.setQueryTime( System.currentTimeMillis() - start );        } catch ( Exception e ) {            throw new RemoteException( "query execution failed: " +                e.getMessage() );        }        return resp;    }