Buggy code:
public class QueryComponent extends SearchComponent { public static final String COMPONENT_NAME = "query" ; @ Override public void prepare ( ResponseBuilder rb ) throws IOException { } @ Override public void process ( ResponseBuilder rb ) throws IOException { } protected void doFieldSortValues ( ResponseBuilder rb , SolrIndexSearcher searcher ) throws IOException { SolrQueryRequest req = rb . req ; SolrQueryResponse rsp = rb . rsp ; final CharsRef spare = new CharsRef ( ) ; boolean fsv = req . getParams ( ) . getBool ( FIELD_SORT_VALUES , false ) ; if ( fsv ) { Sort sort = searcher . weightSort ( rb . getSortSpec ( ) . getSort ( ) ) ; SortField [ ] sortFields = ( sort == null ) ? new SortField [ ] { SortField . FIELD_SCORE } : sort . getSort ( ) ; NamedList < Object [ ] > sortVals = new NamedList < Object [ ] > ( ) ; <START_BUG> Field field = new StringField ( "dummy" , "" ) ; <END_BUG> IndexReaderContext topReaderContext = searcher . getTopReaderContext ( ) ; AtomicReaderContext [ ] leaves = topReaderContext . leaves ( ) ; AtomicReaderContext currentLeaf = null ; if ( ( leaves . length ) == 1 ) { currentLeaf = leaves [ 0 ] ; leaves = null ; } DocList docList = rb . getResults ( ) . docList ; int nDocs = docList . size ( ) ; long [ ] sortedIds = new long [ nDocs ] ; DocIterator it = rb . getResults ( ) . docList . iterator ( ) ; for ( int i = 0 ; i < nDocs ; i ++ ) { sortedIds [ i ] = ( ( ( long ) ( it . nextDoc ( ) ) ) << 32 ) | i ; } Arrays . sort ( sortedIds ) ; for ( SortField sortField : sortFields ) { SortField . Type type = sortField . getType ( ) ; if ( ( type == ( Type . SCORE ) ) || ( type == ( Type . DOC ) ) ) continue ; FieldComparator comparator = null ; String fieldname = sortField . getField ( ) ; FieldType ft = ( fieldname == null ) ? null : req . getSchema ( ) . getFieldTypeNoEx ( fieldname ) ; Object [ ] vals = new Object [ nDocs ] ; int lastIdx = - 1 ; int idx = 0 ; for ( long idAndPos : sortedIds ) { int doc = ( ( int ) ( idAndPos > > > 32 ) ) ; int position = ( ( int ) ( idAndPos ) ) ; if ( leaves != null ) { idx = ReaderUtil . subIndex ( doc , leaves ) ; currentLeaf = leaves [ idx ] ; if ( idx != lastIdx ) { comparator = null ; } } if ( comparator == null ) { comparator = sortField . getComparator ( 1 , 0 ) ; comparator = comparator . setNextReader ( currentLeaf ) ; } doc -= currentLeaf . docBase ; comparator . copy ( 0 , doc ) ; Object val = comparator . value ( 0 ) ; if ( val instanceof String ) { field . setStringValue ( ( ( String ) ( val ) ) ) ; val = ft . toObject ( field ) ; } if ( val instanceof BytesRef ) { UnicodeUtil . UTF8toUTF16 ( ( ( BytesRef ) ( val ) ) , spare ) ; field . setStringValue ( spare . toString ( ) ) ; val = ft . toObject ( field ) ; } vals [ position ] = val ; } sortVals . add ( fieldname , vals ) ; } rsp . add ( "sort_values" , sortVals ) ; } } protected void doPrefetch ( ResponseBuilder rb ) throws IOException { } @ Override public int distributedProcess ( ResponseBuilder rb ) throws IOException { } private int groupedDistributedProcess ( ResponseBuilder rb ) { } private int regularDistributedProcess ( ResponseBuilder rb ) { } @ Override public void handleResponses ( ResponseBuilder rb , ShardRequest sreq ) { } private void handleGroupedResponses ( ResponseBuilder rb , ShardRequest sreq ) { } private void handleRegularResponses ( ResponseBuilder rb , ShardRequest sreq ) { } @ Override public void finishStage ( ResponseBuilder rb ) { } private static final EndResultTransformer MAIN_END_RESULT_TRANSFORMER = new MainEndResultTransformer ( ) ; private static final EndResultTransformer SIMPLE_END_RESULT_TRANSFORMER = new SimpleEndResultTransformer ( ) ; @ SuppressWarnings ( "unchecked" ) private void groupedFinishStage ( final ResponseBuilder rb ) { } private void regularFinishStage ( ResponseBuilder rb ) { } private void createDistributedIdf ( ResponseBuilder rb ) { } private void createMainQuery ( ResponseBuilder rb ) { } private void mergeIds ( ResponseBuilder rb , ShardRequest sreq ) { } private void createRetrieveDocs ( ResponseBuilder rb ) { } private void returnFields ( ResponseBuilder rb , ShardRequest sreq ) { } @ Override public String getDescription ( ) { } @ Override public String getSource ( ) { } @ Override public URL [ ] getDocs ( ) { } }

Fix:
Field field = new org . apache . lucene . document . StringField ( "dummy" , "" , Store . NO ) ;