Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 @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;
 }