mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 05:18:58 +00:00
(minor) Remove dead code
This commit is contained in:
parent
7e216db463
commit
6cba6aef3b
@ -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);
|
||||
}
|
||||
}
|
@ -147,51 +147,6 @@ public class ResultValuator {
|
||||
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) {
|
||||
if (value < 0)
|
||||
value = 0;
|
||||
|
@ -46,7 +46,7 @@ public class ClusteredUrlDetails implements Comparable<ClusteredUrlDetails> {
|
||||
return urlDetails.resultItem.keywordScores.stream()
|
||||
.filter(score -> !score.keyword.contains(":"))
|
||||
.collect(Collectors.toMap(
|
||||
score -> score.subquery,
|
||||
score -> -1, // FIXME
|
||||
score -> score.hasTermFlag(WordFlags.Title)
|
||||
| score.hasTermFlag(WordFlags.ExternalLink)
|
||||
| score.hasTermFlag(WordFlags.UrlDomain)
|
||||
|
Loading…
Reference in New Issue
Block a user