If you implement ScoreFunction.needsScores()to return true, then the second argument of the subQueryScore argument of LeafScoreFunction.score should have the original score for the query. For example, to implement a score function which multiplies the original score by 2:
public class MyScoreFunction {
@Override
public boolean needsScores() {
return true;
}
@Override
public LeafScoreFunction getLeafScoreFunction(LeafReaderContext ctx) throws IOException {
return new LeafScoreFunction() {
@Override
public double score(int docId, float subQueryScore) throws IOException {
return 2.0f * subQueryScore;
}
}
}
...
}