protected final QueryEngine queryEngine() {
if (queryEngine == null) {
try {
engineInitLock.lock();
if (queryEngine == null) {
QueryEngineBuilder builder = null;
if (!repoConfig.getIndexProviders().isEmpty()) {
// There is at least one index provider ...
builder = IndexQueryEngine.builder();
logger.debug("Queries with indexes are enabled for the '{0}' repository. Executing queries may require scanning the repository contents when the query cannot use the defined indexes.",
repoConfig.getName());
} else {
// There are no indexes ...
builder = ScanningQueryEngine.builder();
logger.debug("Queries with no indexes are enabled for the '{0}' repository. Executing queries will always scan the repository contents.",
repoConfig.getName());
}
queryEngine = builder.using(repoConfig, indexManager, runningState.context()).build();
}
} finally {
engineInitLock.unlock();
}
}