Java 类org.apache.lucene.index.FilterAtomicReader 实例源码

项目:search    文件:AnalyzingInfixSuggester.java   
@Override
public long ramBytesUsed() {
  long mem = RamUsageEstimator.shallowSizeOf(this);
  try {
    if (searcherMgr != null) {
      IndexSearcher searcher = searcherMgr.acquire();
      try {
        for (AtomicReaderContext context : searcher.getIndexReader().leaves()) {
          AtomicReader reader = FilterAtomicReader.unwrap(context.reader());
          if (reader instanceof SegmentReader) {
            mem += ((SegmentReader) context.reader()).ramBytesUsed();
          }
        }
      } finally {
        searcherMgr.release(searcher);
      }
    }
    return mem;
  } catch (IOException ioe) {
    throw new RuntimeException(ioe);
  }
}
项目:read-open-source-code    文件:AnalyzingInfixSuggester.java   
@Override
public long ramBytesUsed() {
  long mem = RamUsageEstimator.shallowSizeOf(this);
  try {
    if (searcherMgr != null) {
      IndexSearcher searcher = searcherMgr.acquire();
      try {
        for (AtomicReaderContext context : searcher.getIndexReader().leaves()) {
          AtomicReader reader = FilterAtomicReader.unwrap(context.reader());
          if (reader instanceof SegmentReader) {
            mem += ((SegmentReader) context.reader()).ramBytesUsed();
          }
        }
      } finally {
        searcherMgr.release(searcher);
      }
    }
    return mem;
  } catch (IOException ioe) {
    throw new RuntimeException(ioe);
  }
}
项目:lams    文件:NumericUtils.java   
private static Terms intTerms(Terms terms) {
  return new FilterAtomicReader.FilterTerms(terms) {
      @Override
      public TermsEnum iterator(TermsEnum reuse) throws IOException {
        return filterPrefixCodedInts(in.iterator(reuse));
      }
    };
}
项目:lams    文件:NumericUtils.java   
private static Terms longTerms(Terms terms) {
  return new FilterAtomicReader.FilterTerms(terms) {
      @Override
      public TermsEnum iterator(TermsEnum reuse) throws IOException {
        return filterPrefixCodedLongs(in.iterator(reuse));
      }
    };
}
项目:search    文件:NumericUtils.java   
private static Terms intTerms(Terms terms) {
  return new FilterAtomicReader.FilterTerms(terms) {
      @Override
      public TermsEnum iterator(TermsEnum reuse) throws IOException {
        return filterPrefixCodedInts(in.iterator(reuse));
      }
    };
}
项目:search    文件:NumericUtils.java   
private static Terms longTerms(Terms terms) {
  return new FilterAtomicReader.FilterTerms(terms) {
      @Override
      public TermsEnum iterator(TermsEnum reuse) throws IOException {
        return filterPrefixCodedLongs(in.iterator(reuse));
      }
    };
}
项目:incubator-blur    文件:PrimeDocOverFlowHelper.java   
private static AtomicReader setDocSize(AtomicReader reader, final int count) {
  return new FilterAtomicReader(reader) {
    @Override
    public Bits getLiveDocs() {
      return new Bits() {
        @Override
        public boolean get(int index) {
          return true;
        }

        @Override
        public int length() {
          return count;
        }
      };
    }

    @Override
    public int numDocs() {
      return count;
    }

    @Override
    public int maxDoc() {
      return count;
    }

    @Override
    public void document(int docID, StoredFieldVisitor visitor) throws IOException {
      // Do nothing
    }
  };
}
项目:read-open-source-code    文件:NumericUtils.java   
private static Terms intTerms(Terms terms) {
  return new FilterAtomicReader.FilterTerms(terms) {
      @Override
      public TermsEnum iterator(TermsEnum reuse) throws IOException {
        return filterPrefixCodedInts(in.iterator(reuse));
      }
    };
}
项目:read-open-source-code    文件:NumericUtils.java   
private static Terms longTerms(Terms terms) {
  return new FilterAtomicReader.FilterTerms(terms) {
      @Override
      public TermsEnum iterator(TermsEnum reuse) throws IOException {
        return filterPrefixCodedLongs(in.iterator(reuse));
      }
    };
}