QueryParser queryParser = new QueryParser();
SearchFactoryIntegrator searchFactory = (SearchFactoryIntegrator) searchManager.getSearchFactory();
if (cache.getCacheConfiguration().compatibility().enabled()) {
final QueryInterceptor queryInterceptor = ComponentRegistryUtils.getQueryInterceptor(cache);
EntityNamesResolver entityNamesResolver = new EntityNamesResolver() {
@Override
public Class<?> getClassFromName(String entityName) {
MessageMarshaller messageMarshaller = (MessageMarshaller) serCtx.getMarshaller(entityName);
Class clazz = messageMarshaller.getJavaClass();
return queryInterceptor.isIndexed(clazz) ? clazz : null;
}
};
LuceneProcessingChain processingChain = new LuceneProcessingChain.Builder(searchFactory, entityNamesResolver)
.buildProcessingChainForClassBasedEntities();
LuceneQueryParsingResult parsingResult = queryParser.parseQuery(request.getJpqlString(), processingChain);
MessageMarshaller messageMarshaller = (MessageMarshaller) serCtx.getMarshaller(parsingResult.getTargetEntity());
messageDescriptor = serCtx.getMessageDescriptor(messageMarshaller.getTypeName());
targetEntity = parsingResult.getTargetEntity();
projections = parsingResult.getProjections();
luceneQuery = parsingResult.getQuery();
} else {
EntityNamesResolver entityNamesResolver = new EntityNamesResolver() {
@Override
public Class<?> getClassFromName(String entityName) {
return serCtx.canMarshall(entityName) ? ProtobufValueWrapper.class : null;
}
};