mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
Adjust search result sort order to penalize scriptiness a bit
This commit is contained in:
parent
8bd88c7d40
commit
d7167f956e
@ -92,9 +92,10 @@ public class EdgeUrlDetails {
|
||||
public String getQualityPercent() {
|
||||
return String.format("%2.2f%%", 100*Math.exp(urlQuality+urlQualityAdjustment.getScore()));
|
||||
}
|
||||
|
||||
public double getRanking() {
|
||||
double lengthAdjustment = Math.max(1, words / (words + 1000.));
|
||||
return (1+termScore)*Math.sqrt(1+rankingId)/Math.max(1E-10, lengthAdjustment *(0.7+0.3*Math.exp(urlQualityAdjustment.getScore())));
|
||||
return getFeatureScore()*Math.sqrt(1+rankingId)/Math.max(1E-10, lengthAdjustment *(0.7+0.3*Math.exp(urlQualityAdjustment.getScore())));
|
||||
}
|
||||
|
||||
public int getSuperficialHash() {
|
||||
@ -143,4 +144,23 @@ public class EdgeUrlDetails {
|
||||
public String getRankingSymbolDesc() {
|
||||
return EdgeSearchRankingSymbols.getRankingSymbolDescription(termScore);
|
||||
}
|
||||
|
||||
public double getFeatureScore() {
|
||||
double score = 1;
|
||||
if (isScripts()) {
|
||||
score+=1;
|
||||
} else if(!"HTML5".equals(format)) {
|
||||
score+=0.5;
|
||||
}
|
||||
if (isAffiliate()) {
|
||||
score += 2.5;
|
||||
}
|
||||
if (isTracking()) {
|
||||
score += 1.5;
|
||||
}
|
||||
if (isCookies()) {
|
||||
score += 1.5;
|
||||
}
|
||||
return score;
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,8 @@ public class EdgeSearchOperator {
|
||||
this.valuator = valuator;
|
||||
|
||||
Comparator<EdgeUrlDetails> c = Comparator.comparing(ud -> Math.round(10*(ud.getTermScore() - ud.rankingIdAdjustment())));
|
||||
resultListComparator = c.thenComparing(EdgeUrlDetails::getRanking).thenComparing(EdgeUrlDetails::getId);
|
||||
resultListComparator = c.thenComparing(EdgeUrlDetails::getRanking)
|
||||
.thenComparing(EdgeUrlDetails::getId);
|
||||
}
|
||||
|
||||
public List<EdgeUrlDetails> doApiSearch(Context ctx,
|
||||
|
Loading…
Reference in New Issue
Block a user