protected <E> CacheQuery<E> buildLuceneQuery(IckleParsingResult<TypeMetadata> ickleParsingResult, Map<String, Object> namedParameters, long startOffset, int maxResults, IndexedQueryMode queryMode) {
      if (log.isDebugEnabled()) {
         log.debugf("Building Lucene query for : %s", ickleParsingResult.getQueryString());
      }

      if (!isIndexed) {
         throw log.cannotRunLuceneQueriesIfNotIndexed(cache.getName());
      }

      LuceneQueryParsingResult luceneParsingResult = transformParsingResult(ickleParsingResult, namedParameters);
      org.apache.lucene.search.Query luceneQuery = makeTypeQuery(luceneParsingResult.getQuery(), luceneParsingResult.getTargetEntityName());

      if (log.isDebugEnabled()) {
         log.debugf("The resulting Lucene query is : %s", luceneQuery.toString());
      }

      CacheQuery<?> cacheQuery = makeCacheQuery(ickleParsingResult, luceneQuery, queryMode, namedParameters);
      // No need to set sort and projection if BROADCAST, as both are part of the query string already.
      if (queryMode != IndexedQueryMode.BROADCAST) {
         if (luceneParsingResult.getSort() != null) {
            cacheQuery = cacheQuery.sort(luceneParsingResult.getSort());
         }
         if (luceneParsingResult.getProjections() != null) {
            cacheQuery = cacheQuery.projection(luceneParsingResult.getProjections());
         }
      }
      if (startOffset >= 0) {
         cacheQuery = cacheQuery.firstResult((int) startOffset);
      }
      if (maxResults > 0) {
         cacheQuery = cacheQuery.maxResults(maxResults);
      }

      return (CacheQuery<E>) cacheQuery;
   }
protected < E > CacheQuery < E > buildLuceneQuery ( IckleParsingResult < TypeMetadata > ickleParsingResult , Map < String , Object > namedParameters , long startOffset , int maxResults , IndexedQueryMode queryMode ) { if ( log . isDebugEnabled ( ) ) { log . debugf ( "Building Lucene query for : %s" , ickleParsingResult . getQueryString ( ) ) ; } if ( ! isIndexed ) { throw log . cannotRunLuceneQueriesIfNotIndexed ( cache . getName ( ) ) ; } LuceneQueryParsingResult luceneParsingResult = transformParsingResult ( ickleParsingResult , namedParameters ) ; org . apache . lucene . search . Query luceneQuery = makeTypeQuery ( luceneParsingResult . getQuery ( ) , luceneParsingResult . getTargetEntityName ( ) ) ; if ( log . isDebugEnabled ( ) ) { log . debugf ( "The resulting Lucene query is : %s" , luceneQuery . toString ( ) ) ; } CacheQuery < ? > cacheQuery = makeCacheQuery ( ickleParsingResult , luceneQuery , queryMode , namedParameters ) ; if ( queryMode != IndexedQueryMode . BROADCAST ) { if ( luceneParsingResult . getSort ( ) != null ) { cacheQuery = cacheQuery . sort ( luceneParsingResult . getSort ( ) ) ; } if ( luceneParsingResult . getProjections ( ) != null ) { cacheQuery = cacheQuery . projection ( luceneParsingResult . getProjections ( ) ) ; } } if ( startOffset >= 0 ) { cacheQuery = cacheQuery . firstResult ( ( int ) startOffset ) ; } if ( maxResults > 0 ) { cacheQuery = cacheQuery . maxResults ( maxResults ) ; } return ( CacheQuery < E > ) cacheQuery ; }
Build a Lucene index query.