code: public QueryHits evaluate(final Query query, final Sort sort, final long resultFetchHint) throws IOException
     {
        return SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<QueryHits>()
        {
           public QueryHits run() throws Exception
           {
              Query localQuery = query.rewrite(reader);
              QueryHits hits = null;
              if (localQuery instanceof JcrQuery)
              {
                 hits = ((JcrQuery)localQuery).execute(JcrIndexSearcher.this, session, sort);
              }
              if (hits == null)
              {
                 if (sort == null || sort.getSort().length == 0)
                 {
                    hits = new LuceneQueryHits(reader, JcrIndexSearcher.this, query);
                 }
                 else
                 {
                    hits = new SortedLuceneQueryHits(reader, JcrIndexSearcher.this, localQuery, sort, resultFetchHint);
                 }
              }
              return hits;
           }
        });
     }
docs: Evaluates the query and returns the hits that match the query.
  
  @param query           the query to execute.
  @param sort            the sort criteria.
  @param resultFetchHint a hint on how many results should be fetched.
  @return the query hits.
  @throws IOException if an error occurs while executing the query.