protected FunctionDocSet( AtomicReader reader, @Nullable CollectorFieldsVisitor fieldsVisitor, Input<Boolean> condition, List<LuceneCollectorExpression> expressions, int maxDoc, @Nullable Bits acceptDocs) { super(maxDoc, acceptDocs); this.reader = reader; this.fieldsVisitor = fieldsVisitor; //noinspection SimplifiableConditionalExpression this.fieldsVisitorEnabled = fieldsVisitor == null ? false : fieldsVisitor.required(); this.condition = condition; this.expressions = expressions; }
@Override protected boolean matchDoc(int doc) { if (fieldsVisitorEnabled) { fieldsVisitor.reset(); try { reader.document(doc, fieldsVisitor); } catch (IOException e) { throw Throwables.propagate(e); } } for (LuceneCollectorExpression expression : expressions) { expression.setNextDocId(doc); } Boolean value = condition.value(); if (value == null) { return false; } return value; }