Test rewarding linked terms.

This commit is contained in:
vlofgren 2022-08-02 17:43:18 +02:00
parent eaeb3d82df
commit 0b61910b84

View File

@ -40,12 +40,8 @@ public class SearchResultValuator {
double factorSum = 0.; double factorSum = 0.;
for (int i = 0; i < scores.length; i++) { for (int i = 0; i < scores.length; i++) {
final double factorBase;
if (scores[i].link) factorBase = 0.5; final double factor = 1. / (1.0 + weights[i]);
else factorBase = 1.;
final double factor = factorBase / (1.0 + weights[i]);
factorSum += factor; factorSum += factor;
@ -54,6 +50,9 @@ public class SearchResultValuator {
if (!scores[i].link && !scores[i].title) { if (!scores[i].link && !scores[i].title) {
termValue *= lengthPenalty; termValue *= lengthPenalty;
} }
if (scores[i].link) {
termValue /= 2;
}
termSum += termValue; termSum += termValue;
} }