public static SegmentReader getSegmentReader(IndexReader indexReader) {
if (indexReader instanceof SegmentReader) {
return (SegmentReader) indexReader;
}
if (indexReader instanceof ExitableFilterAtomicReader) {
ExitableFilterAtomicReader exitableFilterAtomicReader = (ExitableFilterAtomicReader) indexReader;
AtomicReader originalReader = exitableFilterAtomicReader.getOriginalReader();
return getSegmentReader(originalReader);
}
return null;
}