assert ctx.topLevelInputs().size() == 1;
@SuppressWarnings("unchecked")
final Input<Boolean> condition = (Input<Boolean>) ctx.topLevelInputs().get(0);
@SuppressWarnings("unchecked")
final List<LuceneCollectorExpression> expressions = ctx.docLevelExpressions();
final CollectorContext collectorContext = new CollectorContext();
collectorContext.searchContext(searchContext);
collectorContext.visitor(new LuceneDocCollector.CollectorFieldsVisitor(expressions.size()));
for (LuceneCollectorExpression expression : expressions) {
expression.startCollect(collectorContext);
}
Filter filter = new Filter() {
@Override
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
for (LuceneCollectorExpression expression : expressions) {
expression.setNextReader(context);
}
return BitsFilteredDocIdSet.wrap(
new FunctionDocSet(
context.reader(),
collectorContext.visitor(),
condition,
expressions,
context.reader().maxDoc(),
acceptDocs
),