use of io.crate.operation.collect.collectors.CrateDocCollectorBuilder in project crate by crate.
the class LuceneShardCollectorProvider method getBuilder.
@Override
protected CrateCollector.Builder getBuilder(RoutedCollectPhase collectPhase, boolean requiresScroll, JobCollectContext jobCollectContext) {
SharedShardContext sharedShardContext = jobCollectContext.sharedShardContexts().getOrCreateContext(indexShard.shardId());
Engine.Searcher searcher = sharedShardContext.acquireSearcher();
IndexShard indexShard = sharedShardContext.indexShard();
try {
LuceneQueryBuilder.Context queryContext = luceneQueryBuilder.convert(collectPhase.whereClause(), indexShard.mapperService(), indexShard.indexFieldDataService(), indexShard.indexService().cache());
jobCollectContext.addSearcher(sharedShardContext.readerId(), searcher);
InputFactory.Context<? extends LuceneCollectorExpression<?>> docCtx = docInputFactory.extractImplementations(collectPhase);
return new CrateDocCollectorBuilder(searcher.searcher(), queryContext.query(), queryContext.minScore(), Symbols.containsColumn(collectPhase.toCollect(), DocSysColumns.SCORE), getCollectorContext(sharedShardContext.readerId(), docCtx), jobCollectContext.queryPhaseRamAccountingContext(), docCtx.topLevelInputs(), docCtx.expressions());
} catch (Throwable t) {
searcher.close();
throw t;
}
}
Aggregations