Buggy code:
public class TestCustomScoreQuery extends FunctionTestSetup { public TestCustomScoreQuery ( String name ) { } public void testCustomScoreByte ( ) throws Exception , CorruptIndexException { } public void testCustomScoreShort ( ) throws Exception , CorruptIndexException { } public void testCustomScoreInt ( ) throws Exception , CorruptIndexException { } public void testCustomScoreFloat ( ) throws Exception , CorruptIndexException { } private static class CustomAddQuery extends CustomScoreQuery { CustomAddQuery ( Query q , ValueSourceQuery qValSrc ) { } public String name ( ) { } public float customScore ( int doc , float subQueryScore , float valSrcScore ) { } public Explanation customExplain ( int doc , Explanation subQueryExpl , Explanation valSrcExpl ) { } } private static class CustomMulAddQuery extends CustomScoreQuery { CustomMulAddQuery ( Query q , ValueSourceQuery qValSrc1 , ValueSourceQuery qValSrc2 ) { } public String name ( ) { } public float customScore ( int doc , float subQueryScore , float [ ] valSrcScores ) { } public Explanation customExplain ( int doc , Explanation subQueryExpl , Explanation [ ] valSrcExpls ) { } } private void doTestCustomScore ( String field , FieldScoreQuery . Type tp , double dboost ) throws Exception , CorruptIndexException { float boost = ( ( float ) ( dboost ) ) ; <START_BUG> IndexSearcher s = new IndexSearcher ( dir ) ; <END_BUG> FieldScoreQuery qValSrc = new FieldScoreQuery ( field , tp ) ; QueryParser qp = new QueryParser ( TEXT_FIELD , anlzr ) ; String qtxt = "first<seq2seq4repair_space>aid<seq2seq4repair_space>text" ; Query q1 = qp . parse ( qtxt ) ; log ( q1 ) ; CustomScoreQuery q2CustomNeutral = new CustomScoreQuery ( q1 ) ; q2CustomNeutral . setBoost ( boost ) ; log ( q2CustomNeutral ) ; CustomScoreQuery q3CustomMul = new CustomScoreQuery ( q1 , qValSrc ) ; q3CustomMul . setStrict ( true ) ; q3CustomMul . setBoost ( boost ) ; log ( q3CustomMul ) ; CustomScoreQuery q4CustomAdd = new TestCustomScoreQuery . CustomAddQuery ( q1 , qValSrc ) ; q4CustomAdd . setStrict ( true ) ; q4CustomAdd . setBoost ( boost ) ; log ( q4CustomAdd ) ; CustomScoreQuery q5CustomMulAdd = new TestCustomScoreQuery . CustomMulAddQuery ( q1 , qValSrc , qValSrc ) ; q5CustomMulAdd . setStrict ( true ) ; q5CustomMulAdd . setBoost ( boost ) ; log ( q5CustomMulAdd ) ; TopDocs td1 = s . search ( q1 , null , 1000 ) ; TopDocs td2CustomNeutral = s . search ( q2CustomNeutral , null , 1000 ) ; TopDocs td3CustomMul = s . search ( q3CustomMul , null , 1000 ) ; TopDocs td4CustomAdd = s . search ( q4CustomAdd , null , 1000 ) ; TopDocs td5CustomMulAdd = s . search ( q5CustomMulAdd , null , 1000 ) ; HashMap h1 = topDocsToMap ( td1 ) ; HashMap h2CustomNeutral = topDocsToMap ( td2CustomNeutral ) ; HashMap h3CustomMul = topDocsToMap ( td3CustomMul ) ; HashMap h4CustomAdd = topDocsToMap ( td4CustomAdd ) ; HashMap h5CustomMulAdd = topDocsToMap ( td5CustomMulAdd ) ; verifyResults ( boost , s , h1 , h2CustomNeutral , h3CustomMul , h4CustomAdd , h5CustomMulAdd , q1 , q2CustomNeutral , q3CustomMul , q4CustomAdd , q5CustomMulAdd ) ; } private void verifyResults ( float boost , IndexSearcher s , HashMap h1 , HashMap h2customNeutral , HashMap h3CustomMul , HashMap h4CustomAdd , HashMap h5CustomMulAdd , Query q1 , Query q2 , Query q3 , Query q4 , Query q5 ) throws Exception { } private void logResult ( String msg , IndexSearcher s , Query q , int doc , float score1 ) throws IOException { } private HashMap topDocsToMap ( TopDocs td ) { } }

Fix:
IndexSearcher s = new IndexSearcher ( dir , true ) ;