package it.cavallium.dbengine.lucene; import it.cavallium.dbengine.utils.SimpleResource; import java.util.stream.Stream; import org.apache.lucene.search.TotalHits; public class LazyFullDocs extends SimpleResource implements FullDocs { private final ResourceIterable pq; private final TotalHits totalHits; public LazyFullDocs(ResourceIterable pq, TotalHits totalHits) { this.pq = pq; this.totalHits = totalHits; } @Override public Stream iterate() { return pq.iterate(); } @Override public Stream iterate(long skips) { return pq.iterate(skips); } @Override public TotalHits totalHits() { return totalHits; } @Override protected void onClose() { pq.close(); } }