(minor) Remove dead code

This commit is contained in:
Viktor Lofgren 2024-04-06 14:34:15 +02:00
parent 7e216db463
commit 6cba6aef3b
3 changed files with 1 additions and 72 deletions

View File

@ -1,26 +0,0 @@
package nu.marginalia.ranking.results;
import nu.marginalia.api.searchquery.model.results.SearchResultKeywordScore;
import java.util.List;
public record ResultKeywordSet(List<SearchResultKeywordScore> keywords) {
public int length() {
return keywords.size();
}
public boolean isEmpty() { return length() == 0; }
public boolean hasNgram() {
for (var word : keywords) {
if (word.keyword.contains("_")) {
return true;
}
}
return false;
}
@Override
public String toString() {
return "%s[%s]".formatted(getClass().getSimpleName(), keywords);
}
}

View File

@ -147,51 +147,6 @@ public class ResultValuator {
return (int) -penalty; return (int) -penalty;
} }
private long documentMetadata(List<SearchResultKeywordScore> rawScores) {
for (var score : rawScores) {
return score.encodedDocMetadata();
}
return 0;
}
private int htmlFeatures(List<SearchResultKeywordScore> rawScores) {
for (var score : rawScores) {
return score.htmlFeatures();
}
return 0;
}
private ResultKeywordSet createKeywordSet(List<SearchResultKeywordScore> rawScores,
int thisSet)
{
List<SearchResultKeywordScore> scoresList = new ArrayList<>();
for (var score : rawScores) {
if (score.subquery != thisSet)
continue;
// Don't consider synthetic keywords for ranking, these are keywords that don't
// have counts. E.g. "tld:edu"
if (score.isKeywordSpecial())
continue;
scoresList.add(score);
}
return new ResultKeywordSet(scoresList);
}
private int numberOfSets(List<SearchResultKeywordScore> scores) {
int maxSet = 0;
for (var score : scores) {
maxSet = Math.max(maxSet, score.subquery);
}
return 1 + maxSet;
}
public static double normalize(double value, double penalty) { public static double normalize(double value, double penalty) {
if (value < 0) if (value < 0)
value = 0; value = 0;

View File

@ -46,7 +46,7 @@ public class ClusteredUrlDetails implements Comparable<ClusteredUrlDetails> {
return urlDetails.resultItem.keywordScores.stream() return urlDetails.resultItem.keywordScores.stream()
.filter(score -> !score.keyword.contains(":")) .filter(score -> !score.keyword.contains(":"))
.collect(Collectors.toMap( .collect(Collectors.toMap(
score -> score.subquery, score -> -1, // FIXME
score -> score.hasTermFlag(WordFlags.Title) score -> score.hasTermFlag(WordFlags.Title)
| score.hasTermFlag(WordFlags.ExternalLink) | score.hasTermFlag(WordFlags.ExternalLink)
| score.hasTermFlag(WordFlags.UrlDomain) | score.hasTermFlag(WordFlags.UrlDomain)