Search in sources :

Example 1 with QueryEngine

use of org.apache.jackrabbit.core.query.lucene.join.QueryEngine in project jackrabbit by apache.

the class QueryObjectModelImpl method execute.

public QueryResult execute() throws RepositoryException {
    long time = System.nanoTime();
    final QueryResult result = sessionContext.getSessionState().perform(new SessionOperation<QueryResult>() {

        public QueryResult perform(SessionContext context) throws RepositoryException {
            final QueryEngine engine = new QueryEngine(sessionContext.getSessionImpl(), lqf, variables);
            return engine.execute(getColumns(), getSource(), getConstraint(), getOrderings(), offset, limit);
        }

        public String toString() {
            return "query.execute(" + statement + ")";
        }
    });
    time = System.nanoTime() - time;
    final long timeMs = time / 1000000;
    log.debug("executed in {} ms. ({})", timeMs, statement);
    RepositoryStatisticsImpl statistics = sessionContext.getRepositoryContext().getRepositoryStatistics();
    statistics.getCounter(Type.QUERY_COUNT).incrementAndGet();
    statistics.getCounter(Type.QUERY_DURATION).addAndGet(timeMs);
    sessionContext.getRepositoryContext().getStatManager().getQueryStat().logQuery(language, statement, timeMs);
    return result;
}
Also used : QueryResult(javax.jcr.query.QueryResult) RepositoryStatisticsImpl(org.apache.jackrabbit.stats.RepositoryStatisticsImpl) SessionContext(org.apache.jackrabbit.core.session.SessionContext) RepositoryException(javax.jcr.RepositoryException) QueryEngine(org.apache.jackrabbit.core.query.lucene.join.QueryEngine)

Aggregations

RepositoryException (javax.jcr.RepositoryException)1 QueryResult (javax.jcr.query.QueryResult)1 QueryEngine (org.apache.jackrabbit.core.query.lucene.join.QueryEngine)1 SessionContext (org.apache.jackrabbit.core.session.SessionContext)1 RepositoryStatisticsImpl (org.apache.jackrabbit.stats.RepositoryStatisticsImpl)1