@Override
public void setNextReader(AtomicReaderContext newContext) throws IOException {
delegate.setNextReader( newContext );
final AtomicReader atomicReader = newContext.reader();
final int numDocs = atomicReader.numDocs();
final Doubles unbasedLatitudeValues = FieldCache.DEFAULT.getDoubles( atomicReader, latitudeField, false );
final Doubles unbasedLongitudeValues = FieldCache.DEFAULT.getDoubles( atomicReader, longitudeField, false );
this.docBase = newContext.docBase;
for ( int i = 0 ; i < numDocs; i ++ ) {
//TODO avoid fully copying this structure - HSEARCH-1499
latitudeValues.put( this.docBase + i, unbasedLatitudeValues.get( i ) );
longitudeValues.put( this.docBase + i, unbasedLongitudeValues.get( i ) );
}
}