mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
Tweaking search result valuation
This commit is contained in:
parent
085d985e61
commit
fb2797a8ef
@ -149,10 +149,10 @@ public class IndexResultValuator {
|
||||
|
||||
positions = EdgePageWordMetadata.decodePositions(meta);
|
||||
|
||||
maskAdjacent &= (positions | (positions << 1) | (positions >>> 1));
|
||||
maskDirectRaw &= positions;
|
||||
|
||||
if (positions == 0 && !EdgePageWordMetadata.hasAnyFlags(meta, flagBitMask)) {
|
||||
if (positions != 0 && !EdgePageWordMetadata.hasAnyFlags(meta, flagBitMask)) {
|
||||
maskAdjacent &= (positions | (positions << 1) | (positions >>> 1));
|
||||
maskDirectGenerous &= positions;
|
||||
}
|
||||
|
||||
|
@ -145,18 +145,41 @@ public class SearchResultValuator {
|
||||
totalFactor *= getAllTermsFactor(keyword, totalWeight, titleLength);
|
||||
}
|
||||
|
||||
totalFactor = calculateTermCoherencePenalty(set, totalFactor);
|
||||
if (set.keywords.length > 1) {
|
||||
totalFactor = calculateTermCoherencePenalty(set, totalFactor);
|
||||
}
|
||||
else {
|
||||
totalFactor = calculateSingleTermBonus(set, totalFactor);
|
||||
}
|
||||
|
||||
return totalFactor;
|
||||
}
|
||||
|
||||
private double calculateSingleTermBonus(SearchResultsKeywordSet set, double totalFactor) {
|
||||
var theKeyword = set.iterator().next();
|
||||
|
||||
if (theKeyword.wordMetadata.hasFlag(EdgePageWordFlags.Title)) {
|
||||
return totalFactor * 0.5;
|
||||
}
|
||||
else if (theKeyword.wordMetadata.hasFlag(EdgePageWordFlags.Subjects)) {
|
||||
return totalFactor * 0.6;
|
||||
}
|
||||
else if (theKeyword.wordMetadata.hasFlag(EdgePageWordFlags.SiteAdjacent)) {
|
||||
return totalFactor * 0.65;
|
||||
}
|
||||
else if (theKeyword.wordMetadata.hasFlag(EdgePageWordFlags.Site)) {
|
||||
return totalFactor * 0.7;
|
||||
}
|
||||
return totalFactor;
|
||||
}
|
||||
|
||||
private double calculateTermCoherencePenalty(SearchResultsKeywordSet keywordSet, double f) {
|
||||
long maskDirect = ~0;
|
||||
long maskAdjacent = ~0;
|
||||
|
||||
byte excludeMask = (byte) (EdgePageWordFlags.Title.asBit() | EdgePageWordFlags.Subjects.asBit() | EdgePageWordFlags.Synthetic.asBit());
|
||||
|
||||
for (var keyword : keywordSet.keywords) {
|
||||
for (var keyword : keywordSet) {
|
||||
var meta = keyword.wordMetadata;
|
||||
long positions;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user