Class SlowCompositeReaderWrapper

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public final class SlowCompositeReaderWrapper
    extends AtomicReader
    This class forces a composite reader (eg a MultiReader or DirectoryReader) to emulate an atomic reader. This requires implementing the postings APIs on-the-fly, using the static methods in MultiFields, MultiDocValues, by stepping through the sub-readers to merge fields/terms, appending docs, etc.

    NOTE: this class almost always results in a performance hit. If this is important to your use case, you'll get better performance by gathering the sub readers using IndexReader.getContext() to get the atomic leaves and then operate per-AtomicReader, instead of using this class.