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 { } @ Override public int distributedProcess ( ResponseBuilder rb ) throws IOException { } @ Override public void handleResponses ( ResponseBuilder rb , ShardRequest sreq ) { } @ Override public void finishStage ( ResponseBuilder rb ) { } private void createDistributedIdf ( ResponseBuilder rb ) { } private void createMainQuery ( ResponseBuilder rb ) { ShardRequest sreq = new ShardRequest ( ) ; sreq . purpose = ShardRequest . PURPOSE_GET_TOP_IDS ; sreq . params = new org . apache . solr . common . params . ModifiableSolrParams ( rb . req . getParams ( ) ) ; sreq . params . remove ( SHARDS ) ; sreq . params . set ( START , "0" ) ; sreq . params . set ( ROWS , ( ( rb . getSortSpec ( ) . getOffset ( ) ) + ( rb . getSortSpec ( ) . getCount ( ) ) ) ) ; sreq . params . set ( FIELD_SORT_VALUES , "true" ) ; <START_BUG> if ( rb . getSortSpec ( ) . includesScore ( ) ) { <END_BUG> sreq . params . set ( FL , ( ( rb . req . getSchema ( ) . getUniqueKeyField ( ) . getName ( ) ) + ",score" ) ) ; } else { sreq . params . set ( FL , rb . req . getSchema ( ) . getUniqueKeyField ( ) . getName ( ) ) ; } rb . addRequest ( this , sreq ) ; } private void mergeIds ( ResponseBuilder rb , ShardRequest sreq ) { } private void createRetrieveDocs ( ResponseBuilder rb ) { } private void returnFields ( ResponseBuilder rb , ShardRequest sreq ) { } static ScoreDocComparator comparatorInt ( final IndexReader reader , final String fieldname ) throws IOException { } static ScoreDocComparator comparatorLong ( final IndexReader reader , final String fieldname ) throws IOException { } static ScoreDocComparator comparatorFloat ( final IndexReader reader , final String fieldname ) throws IOException { } static ScoreDocComparator comparatorDouble ( final IndexReader reader , final String fieldname ) throws IOException { } static ScoreDocComparator comparatorString ( final IndexReader reader , final String fieldname ) throws IOException { } static ScoreDocComparator comparatorStringLocale ( final IndexReader reader , final String fieldname , final Locale locale ) throws IOException { } static class StringFieldable implements Fieldable { public String val ; public void setBoost ( float boost ) { } public float getBoost ( ) { } public String name ( ) { } public String stringValue ( ) { } public Reader readerValue ( ) { } public byte [ ] binaryValue ( ) { } public TokenStream tokenStreamValue ( ) { } public boolean isStored ( ) { } public boolean isIndexed ( ) { } public boolean isTokenized ( ) { } public boolean isCompressed ( ) { } public boolean isTermVectorStored ( ) { } public boolean isStoreOffsetWithTermVector ( ) { } public boolean isStorePositionWithTermVector ( ) { } public boolean isBinary ( ) { } public boolean getOmitNorms ( ) { } public void setOmitNorms ( boolean omitNorms ) { } public boolean isLazy ( ) { } } @ Override public String getDescription ( ) { } @ Override public String getVersion ( ) { } @ Override public String getSourceId ( ) { } @ Override public String getSource ( ) { } @ Override public URL [ ] getDocs ( ) { } }

Fix:
if ( ( ( ( rb . getFieldFlags ( ) ) & ( SolrIndexSearcher . GET_SCORES ) ) != 0 ) || ( rb . getSortSpec ( ) . includesScore ( ) ) ) {