Buggy code:
public abstract class TopFieldCollector extends TopDocsCollector < Entry > { private static class OneComparatorNonScoringCollector extends TopFieldCollector { FieldComparator comparator ; final int reverseMul ; final FieldValueHitQueue queue ; public OneComparatorNonScoringCollector ( FieldValueHitQueue queue , int numHits , boolean fillFields ) throws IOException { } final void updateBottom ( int doc ) { } @ Override public void collect ( int doc ) throws IOException { } @ Override public void setNextReader ( AtomicReaderContext context ) throws IOException { this . docBase = context . docBase ; queue . setComparator ( 0 , comparator . setNextReader ( context ) ) ; comparator = queue . firstComparator ; } @ Override public void setScorer ( Scorer scorer ) throws IOException { } } private static class OutOfOrderOneComparatorNonScoringCollector extends TopFieldCollector . OneComparatorNonScoringCollector { public OutOfOrderOneComparatorNonScoringCollector ( FieldValueHitQueue queue , int numHits , boolean fillFields ) throws IOException { } @ Override public void collect ( int doc ) throws IOException { } @ Override public boolean acceptsDocsOutOfOrder ( ) { } } private static class OneComparatorScoringNoMaxScoreCollector extends TopFieldCollector . OneComparatorNonScoringCollector { Scorer scorer ; public OneComparatorScoringNoMaxScoreCollector ( FieldValueHitQueue queue , int numHits , boolean fillFields ) throws IOException { } final void updateBottom ( int doc , float score ) { } @ Override public void collect ( int doc ) throws IOException { } @ Override public void setScorer ( Scorer scorer ) throws IOException { } } private static class OutOfOrderOneComparatorScoringNoMaxScoreCollector extends TopFieldCollector . OneComparatorScoringNoMaxScoreCollector { public OutOfOrderOneComparatorScoringNoMaxScoreCollector ( FieldValueHitQueue queue , int numHits , boolean fillFields ) throws IOException { } @ Override public void collect ( int doc ) throws IOException { } @ Override public boolean acceptsDocsOutOfOrder ( ) { } } private static class OneComparatorScoringMaxScoreCollector extends TopFieldCollector . OneComparatorNonScoringCollector { Scorer scorer ; public OneComparatorScoringMaxScoreCollector ( FieldValueHitQueue queue , int numHits , boolean fillFields ) throws IOException { } final void updateBottom ( int doc , float score ) { } @ Override public void collect ( int doc ) throws IOException { } @ Override public void setScorer ( Scorer scorer ) throws IOException { } } private static class OutOfOrderOneComparatorScoringMaxScoreCollector extends TopFieldCollector . OneComparatorScoringMaxScoreCollector { public OutOfOrderOneComparatorScoringMaxScoreCollector ( FieldValueHitQueue queue , int numHits , boolean fillFields ) throws IOException { } @ Override public void collect ( int doc ) throws IOException { } @ Override public boolean acceptsDocsOutOfOrder ( ) { } } private static class MultiComparatorNonScoringCollector extends TopFieldCollector { final FieldComparator [ ] comparators ; final int [ ] reverseMul ; final FieldValueHitQueue queue ; public MultiComparatorNonScoringCollector ( FieldValueHitQueue queue , int numHits , boolean fillFields ) throws IOException { } final void updateBottom ( int doc ) { } @ Override public void collect ( int doc ) throws IOException { } @ Override public void setNextReader ( AtomicReaderContext context ) throws IOException { <START_BUG> this . docBase = context . docBase ; <END_BUG> for ( int i = 0 ; i < ( comparators . length ) ; i ++ ) { queue . setComparator ( i , comparators [ i ] . setNextReader ( context ) ) ; } } @ Override public void setScorer ( Scorer scorer ) throws IOException { } } private static class OutOfOrderMultiComparatorNonScoringCollector extends TopFieldCollector . MultiComparatorNonScoringCollector { public OutOfOrderMultiComparatorNonScoringCollector ( FieldValueHitQueue queue , int numHits , boolean fillFields ) throws IOException { } @ Override public void collect ( int doc ) throws IOException { } @ Override public boolean acceptsDocsOutOfOrder ( ) { } } private static class MultiComparatorScoringMaxScoreCollector extends TopFieldCollector . MultiComparatorNonScoringCollector { Scorer scorer ; public MultiComparatorScoringMaxScoreCollector ( FieldValueHitQueue queue , int numHits , boolean fillFields ) throws IOException { } final void updateBottom ( int doc , float score ) { } @ Override public void collect ( int doc ) throws IOException { } @ Override public void setScorer ( Scorer scorer ) throws IOException { } } private static final class OutOfOrderMultiComparatorScoringMaxScoreCollector extends TopFieldCollector . MultiComparatorScoringMaxScoreCollector { public OutOfOrderMultiComparatorScoringMaxScoreCollector ( FieldValueHitQueue queue , int numHits , boolean fillFields ) throws IOException { } @ Override public void collect ( int doc ) throws IOException { } @ Override public boolean acceptsDocsOutOfOrder ( ) { } } private static class MultiComparatorScoringNoMaxScoreCollector extends TopFieldCollector . MultiComparatorNonScoringCollector { Scorer scorer ; public MultiComparatorScoringNoMaxScoreCollector ( FieldValueHitQueue queue , int numHits , boolean fillFields ) throws IOException { } final void updateBottom ( int doc , float score ) { } @ Override public void collect ( int doc ) throws IOException { } @ Override public void setScorer ( Scorer scorer ) throws IOException { } } private static final class OutOfOrderMultiComparatorScoringNoMaxScoreCollector extends TopFieldCollector . MultiComparatorScoringNoMaxScoreCollector { public OutOfOrderMultiComparatorScoringNoMaxScoreCollector ( FieldValueHitQueue queue , int numHits , boolean fillFields ) throws IOException { } @ Override public void collect ( int doc ) throws IOException { } @ Override public void setScorer ( Scorer scorer ) throws IOException { } @ Override public boolean acceptsDocsOutOfOrder ( ) { } } private static final ScoreDoc [ ] EMPTY_SCOREDOCS = new ScoreDoc [ 0 ] ; private final boolean fillFields ; float maxScore = Float . NaN ; final int numHits ; Entry bottom = null ; boolean queueFull ; int docBase ; private TopFieldCollector ( PriorityQueue < Entry > pq , int numHits , boolean fillFields ) { } public static TopFieldCollector create ( Sort sort , int numHits , boolean fillFields , boolean trackDocScores , boolean trackMaxScore , boolean docsScoredInOrder ) throws IOException { } final void add ( int slot , int doc , float score ) { } @ Override protected void populateResults ( ScoreDoc [ ] results , int howMany ) { } @ Override protected TopDocs newTopDocs ( ScoreDoc [ ] results , int start ) { } @ Override public boolean acceptsDocsOutOfOrder ( ) { } }

Fix:
docBase = context . docBase ;