mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 13:09:00 +00:00
(ranking) Promote documents with multiple phrase matches with a log-scale bonus
This commit is contained in:
parent
e11ebf18e5
commit
7b64377fd6
@ -398,9 +398,10 @@ public class IndexResultScoreCalculator {
|
||||
|
||||
// Capture full query matches
|
||||
for (var tag : HtmlTag.includedTags) {
|
||||
if (spans.getSpan(tag).containsRange(fullGroupIntersections, fullGroup.size)) {
|
||||
int cnts = spans.getSpan(tag).countRangeMatches(fullGroupIntersections, fullGroup.size);
|
||||
if (cnts > 0) {
|
||||
matches.set(tag.ordinal());
|
||||
score += weights_full[tag.ordinal()] * fullGroup.size;
|
||||
score += (float) (weights_full[tag.ordinal()] * fullGroup.size + (1 + Math.log(2 + cnts)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -417,9 +418,11 @@ public class IndexResultScoreCalculator {
|
||||
float sizeScalingFactor = groupSize / (float) largestOptional;
|
||||
|
||||
IntList intersections = optionalGroup.findIntersections(positions);
|
||||
|
||||
for (var tag : HtmlTag.includedTags) {
|
||||
if (spans.getSpan(tag).containsRange(intersections, groupSize)) {
|
||||
score += weights_partial[tag.ordinal()] * optionalGroup.size * sizeScalingFactor;
|
||||
int cnts = spans.getSpan(tag).countRangeMatches(intersections, fullGroup.size);;
|
||||
if (cnts > 0) {
|
||||
score += (float) (weights_partial[tag.ordinal()] * optionalGroup.size * sizeScalingFactor * (1 + Math.log(2 + cnts)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user