Buggy code:
public class FileFloatSource extends ValueSource { private SchemaField field ; private final SchemaField keyField ; private final float defVal ; private final String dataDir ; public FileFloatSource ( SchemaField field , SchemaField keyField , float defVal , QParser parser ) { } @ Override public String description ( ) { } @ Override public FunctionValues getValues ( Map context , AtomicReaderContext readerContext ) throws IOException { } @ Override public boolean equals ( Object o ) { } @ Override public int hashCode ( ) { } @ Override public String toString ( ) { } public static void resetCache ( ) { } private final float [ ] getCachedFloats ( IndexReader reader ) { } static FileFloatSource . Cache floatCache = new FileFloatSource . Cache ( ) { @ Override protected Object createValue ( IndexReader reader , Object key ) { } } ; abstract static class Cache { private final Map readerCache = new WeakHashMap ( ) ; protected abstract Object createValue ( IndexReader reader , Object key ) { } public Object get ( IndexReader reader , Object key ) { } public void resetCache ( ) { } } static Object onlyForTesting ; static final class CreationPlaceholder { Object value ; } private static class Entry { final FileFloatSource ffs ; public Entry ( FileFloatSource ffs ) { } @ Override public boolean equals ( Object o ) { } @ Override public int hashCode ( ) { } } private static float [ ] getFloats ( FileFloatSource ffs , IndexReader reader ) { float [ ] vals = new float [ reader . maxDoc ( ) ] ; if ( ( ffs . defVal ) != 0 ) { Arrays . fill ( vals , ffs . defVal ) ; } InputStream is ; String fname = "external_" + ( ffs . field . getName ( ) ) ; try { is = VersionedFile . getLatestFile ( ffs . dataDir , fname ) ; } catch ( IOException e ) { log . error ( ( "Error<seq2seq4repair_space>opening<seq2seq4repair_space>external<seq2seq4repair_space>value<seq2seq4repair_space>source<seq2seq4repair_space>file:<seq2seq4repair_space>" + e ) ) ; return vals ; } BufferedReader r = new BufferedReader ( new InputStreamReader ( is , IOUtils . CHARSET_UTF_8 ) ) ; String idName = ffs . keyField . getName ( ) ; FieldType idType = ffs . keyField . getType ( ) ; List < String > notFound = new ArrayList < String > ( ) ; int notFoundCount = 0 ; int otherErrors = 0 ; char delimiter = '=' ; BytesRef internalKey = new BytesRef ( ) ; try { TermsEnum termsEnum = MultiFields . getTerms ( reader , idName ) . iterator ( null ) ; DocsEnum docsEnum = null ; for ( String line ; ( line = r . readLine ( ) ) != null ; ) { int delimIndex = line . lastIndexOf ( delimiter ) ; if ( delimIndex < 0 ) continue ; int endIndex = line . length ( ) ; String key = line . substring ( 0 , delimIndex ) ; String val = line . substring ( ( delimIndex + 1 ) , endIndex ) ; float fval ; try { idType . readableToIndexed ( key , internalKey ) ; fval = Float . parseFloat ( val ) ; } catch ( Exception e ) { if ( ( ++ otherErrors ) <= 10 ) { log . error ( ( ( "Error<seq2seq4repair_space>loading<seq2seq4repair_space>external<seq2seq4repair_space>value<seq2seq4repair_space>source<seq2seq4repair_space>+<seq2seq4repair_space>fileName<seq2seq4repair_space>+<seq2seq4repair_space>" + e ) + ( otherErrors < 10 ? "" : "\tSkipping<seq2seq4repair_space>future<seq2seq4repair_space>errors<seq2seq4repair_space>for<seq2seq4repair_space>this<seq2seq4repair_space>file." ) ) ) ; } continue ; } if ( ! ( termsEnum . seekExact ( internalKey , false ) ) ) { if ( notFoundCount < 10 ) { notFound . add ( key ) ; } notFoundCount ++ ; continue ; } <START_BUG> docsEnum = termsEnum . docs ( null , docsEnum , 0 ) ; <END_BUG> int doc ; while ( ( doc = docsEnum . nextDoc ( ) ) != ( DocIdSetIterator . NO_MORE_DOCS ) ) { vals [ doc ] = fval ; } } } catch ( IOException e ) { log . error ( ( "Error<seq2seq4repair_space>loading<seq2seq4repair_space>external<seq2seq4repair_space>value<seq2seq4repair_space>source:<seq2seq4repair_space>" + e ) ) ; } finally { try { r . close ( ) ; } catch ( Exception e ) { } } log . info ( ( ( "Loaded<seq2seq4repair_space>external<seq2seq4repair_space>value<seq2seq4repair_space>source<seq2seq4repair_space>" + fname ) + ( notFoundCount == 0 ? "" : ( ( "<seq2seq4repair_space>:" + notFoundCount ) + "<seq2seq4repair_space>missing<seq2seq4repair_space>keys<seq2seq4repair_space>" ) + notFound ) ) ) ; return vals ; } public static class ReloadCacheRequestHandler extends RequestHandlerBase { static final Logger log = LoggerFactory . getLogger ( FileFloatSource . ReloadCacheRequestHandler . class ) ; @ Override public void handleRequestBody ( SolrQueryRequest req , SolrQueryResponse rsp ) throws Exception { } @ Override public String getDescription ( ) { } @ Override public String getSource ( ) { } } }

Fix:
docsEnum = termsEnum . docs ( null , docsEnum , false ) ;