mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 13:09:00 +00:00
(index) Correct ranking bonus for external linktext appearnces
This commit is contained in:
parent
ea6b148df2
commit
7d1ef08a0f
@ -352,7 +352,7 @@ public class IndexResultScoreCalculator {
|
|||||||
case ANCHOR -> 0.2f;
|
case ANCHOR -> 0.2f;
|
||||||
case NAV -> 0.1f;
|
case NAV -> 0.1f;
|
||||||
case CODE -> 0.25f;
|
case CODE -> 0.25f;
|
||||||
case EXTERNAL_LINKTEXT -> 1.0f;
|
case EXTERNAL_LINKTEXT -> 2.0f;
|
||||||
case BODY -> 1.0f;
|
case BODY -> 1.0f;
|
||||||
default -> 0.0f;
|
default -> 0.0f;
|
||||||
};
|
};
|
||||||
@ -365,7 +365,7 @@ public class IndexResultScoreCalculator {
|
|||||||
case ANCHOR -> 0.2f;
|
case ANCHOR -> 0.2f;
|
||||||
case NAV -> 0.1f;
|
case NAV -> 0.1f;
|
||||||
case CODE -> 0.25f;
|
case CODE -> 0.25f;
|
||||||
case EXTERNAL_LINKTEXT -> 1.0f;
|
case EXTERNAL_LINKTEXT -> 2.0f;
|
||||||
case BODY -> 0.25f;
|
case BODY -> 0.25f;
|
||||||
default -> 0.0f;
|
default -> 0.0f;
|
||||||
};
|
};
|
||||||
@ -387,9 +387,9 @@ public class IndexResultScoreCalculator {
|
|||||||
score += 4; // If the title is a single word and the same as the query, we give it a verbatim bonus
|
score += 4; // If the title is a single word and the same as the query, we give it a verbatim bonus
|
||||||
}
|
}
|
||||||
|
|
||||||
var atagSpan = spans.getSpan(HtmlTag.ANCHOR);
|
var extLinkSpan = spans.getSpan(HtmlTag.EXTERNAL_LINKTEXT);
|
||||||
if (atagSpan.length() == fullGroup.size
|
if (extLinkSpan.length() == fullGroup.size
|
||||||
&& atagSpan.containsRangeExact(fullGroupIntersections, fullGroup.size))
|
&& extLinkSpan.containsRangeExact(fullGroupIntersections, fullGroup.size))
|
||||||
{
|
{
|
||||||
score += 4; // Add additional bonus if there's a single-word atag span
|
score += 4; // Add additional bonus if there's a single-word atag span
|
||||||
}
|
}
|
||||||
@ -405,8 +405,8 @@ public class IndexResultScoreCalculator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bonus if there's a perfect match with an atag span
|
// Bonus if there's a perfect match with an atag span
|
||||||
var atagSpan = spans.getSpan(HtmlTag.ANCHOR);
|
var extLinkSpan = spans.getSpan(HtmlTag.EXTERNAL_LINKTEXT);
|
||||||
if (atagSpan.length() == fullGroup.size && atagSpan.containsRangeExact(fullGroupIntersections, fullGroup.size))
|
if (extLinkSpan.length() == fullGroup.size && extLinkSpan.containsRangeExact(fullGroupIntersections, fullGroup.size))
|
||||||
{
|
{
|
||||||
score += 1;
|
score += 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user