@Override
 public PostingsConsumer startTerm(BytesRef text) throws IOException {
   assert state == TermsConsumerState.INITIAL
       || state == TermsConsumerState.START && lastPostingsConsumer.docFreq == 0;
   state = TermsConsumerState.START;
   assert lastTerm == null || in.getComparator().compare(text, lastTerm) > 0;
   lastTerm = BytesRef.deepCopyOf(text);
   return lastPostingsConsumer =
       new AssertingPostingsConsumer(in.startTerm(text), fieldInfo, visitedDocs);
 }
    @Override
    public void finishTerm(BytesRef text, TermStats stats) throws IOException {

      // Record this term in our BloomFilter
      if (stats.docFreq > 0) {
        bloomFilter.addValue(text);
      }
      delegateTermsConsumer.finishTerm(text, stats);
    }
 @Override
 public void finishTerm(BytesRef text, TermStats stats) throws IOException {
   assert state == TermsConsumerState.START;
   state = TermsConsumerState.INITIAL;
   assert text.equals(lastTerm);
   assert stats.docFreq > 0; // otherwise, this method should not be called.
   assert stats.docFreq == lastPostingsConsumer.docFreq;
   sumDocFreq += stats.docFreq;
   if (fieldInfo.getIndexOptions() == IndexOptions.DOCS_ONLY) {
     assert stats.totalTermFreq == -1;
   } else {
     assert stats.totalTermFreq == lastPostingsConsumer.totalTermFreq;
     sumTotalTermFreq += stats.totalTermFreq;
   }
   in.finishTerm(text, stats);
 }
 @Override
 public void finish(long sumTotalTermFreq, long sumDocFreq, int docCount) throws IOException {
   assert state == TermsConsumerState.INITIAL
       || state == TermsConsumerState.START && lastPostingsConsumer.docFreq == 0;
   state = TermsConsumerState.FINISHED;
   assert docCount >= 0;
   assert docCount == visitedDocs.cardinality();
   assert sumDocFreq >= docCount;
   assert sumDocFreq == this.sumDocFreq;
   if (fieldInfo.getIndexOptions() == IndexOptions.DOCS_ONLY) {
     assert sumTotalTermFreq == -1;
   } else {
     assert sumTotalTermFreq >= sumDocFreq;
     assert sumTotalTermFreq == this.sumTotalTermFreq;
   }
   in.finish(sumTotalTermFreq, sumDocFreq, docCount);
 }
 @Override
 public Comparator<BytesRef> getComparator() throws IOException {
   return delegateTermsConsumer.getComparator();
 }
 @Override
 public void finish(long sumTotalTermFreq, long sumDocFreq, int docCount) throws IOException {
   delegateTermsConsumer.finish(sumTotalTermFreq, sumDocFreq, docCount);
 }
 @Override
 public PostingsConsumer startTerm(BytesRef text) throws IOException {
   return delegateTermsConsumer.startTerm(text);
 }
 @Override
 public Comparator<BytesRef> getComparator() throws IOException {
   return in.getComparator();
 }