From cf7f84f0330ae70b225d3e80782f680338e9d09f Mon Sep 17 00:00:00 2001 From: Viktor Lofgren Date: Tue, 10 Dec 2024 22:04:12 +0100 Subject: [PATCH] (rank) Reduce the impact of domain rank bonus, and only apply it to cancel out negative penalties, never to increase the ranking --- .../searchquery/model/results/ResultRankingParameters.java | 2 +- .../index/results/IndexResultScoreCalculator.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/functions/search-query/api/java/nu/marginalia/api/searchquery/model/results/ResultRankingParameters.java b/code/functions/search-query/api/java/nu/marginalia/api/searchquery/model/results/ResultRankingParameters.java index cba98152..575af8cf 100644 --- a/code/functions/search-query/api/java/nu/marginalia/api/searchquery/model/results/ResultRankingParameters.java +++ b/code/functions/search-query/api/java/nu/marginalia/api/searchquery/model/results/ResultRankingParameters.java @@ -69,7 +69,7 @@ public class ResultRankingParameters { .bm25Params(new Bm25Parameters(1.2, 0.5)) .shortDocumentThreshold(2000) .shortDocumentPenalty(2.) - .domainRankBonus(1 / 25.) + .domainRankBonus(1 / 100.) .qualityPenalty(1 / 15.) .shortSentenceThreshold(2) .shortSentencePenalty(5) diff --git a/code/index/java/nu/marginalia/index/results/IndexResultScoreCalculator.java b/code/index/java/nu/marginalia/index/results/IndexResultScoreCalculator.java index 10f4ea05..20020735 100644 --- a/code/index/java/nu/marginalia/index/results/IndexResultScoreCalculator.java +++ b/code/index/java/nu/marginalia/index/results/IndexResultScoreCalculator.java @@ -129,9 +129,9 @@ public class IndexResultScoreCalculator { double score = normalize( score_firstPosition + score_proximity + score_verbatim + score_bM25 - + score_bFlags - + Math.max(0, documentBonus), - -Math.min(0, documentBonus)); + + score_bFlags, + -Math.min(0, documentBonus) // The magnitude of documentBonus, if it is negative; otherwise 0 + ); if (Double.isNaN(score)) { // This should never happen but if it does, we want to know about it if (getClass().desiredAssertionStatus()) {