#2831 Ensure score is finite before adding to API response in SearchHelper and DefaultSearcher.

This commit is contained in:
Shinsuke Sugaya 2024-07-22 15:56:21 +09:00
parent bc55977e9d
commit 93354ce179
2 changed files with 8 additions and 2 deletions

View file

@ -217,7 +217,10 @@ public class SearchHelper {
}
if (!docMap.containsKey(Constants.SCORE)) {
docMap.put(Constants.SCORE, hit.getScore());
final float score = hit.getScore();
if (Float.isFinite(score)) {
docMap.put(Constants.SCORE, score);
}
}
docMap.put(fessConfig.getIndexFieldId(), hit.getId());

View file

@ -184,7 +184,10 @@ public class DefaultSearcher extends RankFusionSearcher {
}
if (!docMap.containsKey(Constants.SCORE)) {
docMap.put(Constants.SCORE, searchHit.getScore());
final float score = searchHit.getScore();
if (Float.isFinite(score)) {
docMap.put(Constants.SCORE, score);
}
}
if (!docMap.containsKey(fessConfig.getIndexFieldId())) {