diff --git a/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/NDCGAtTen.java b/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/NDCGAtTen.java index f4598d96..bce35ee3 100644 --- a/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/NDCGAtTen.java +++ b/rre-core/src/main/java/io/sease/rre/core/domain/metrics/impl/NDCGAtTen.java @@ -87,7 +87,11 @@ private BigDecimal idealDcg(final JsonNode relevantDocuments) { Arrays.fill(gains, 0, howManyVeryVeryRelevantDocs, 3); if (howManyVeryVeryRelevantDocs < windowSize) { - Arrays.fill(gains, howManyVeryVeryRelevantDocs, howManyVeryVeryRelevantDocs + Math.min((windowSize - howManyVeryVeryRelevantDocs), howManyVeryRelevantDocs), 1); + Arrays.fill(gains, howManyVeryVeryRelevantDocs, howManyVeryVeryRelevantDocs + howManyVeryRelevantDocs, 2); + } + + if (howManyVeryVeryRelevantDocs + howManyVeryRelevantDocs < windowSize) { + Arrays.fill(gains, howManyVeryVeryRelevantDocs + howManyVeryRelevantDocs, gains.length - 1, 1); } BigDecimal result = gains.length > 0 ? new BigDecimal(gains[0]) : BigDecimal.ZERO;