Improving search result scoring in index.

This commit is contained in:
Viktor Lofgren 2023-03-07 21:53:30 +01:00
parent 1252f95da5
commit 6fb0f77eea

View File

@ -58,16 +58,15 @@ public record EdgeSearchResultKeywordScore(int set,
sum -= 1;
}
sum -= WordMetadata.decodeTfidf(encodedWordMetadata) / 50.;
sum += firstPos() / 5.;
sum -= Integer.bitCount(positions()) / 3.;
double tfIdf = WordMetadata.decodeTfidf(encodedWordMetadata);
int positionBits = WordMetadata.decodePositions(encodedWordMetadata);
sum -= tfIdf / 10.;
sum -= Integer.bitCount(positionBits) / 3.;
return sum;
}
public int firstPos() {
return numberOfTrailingZeros(lowestOneBit(WordMetadata.decodePositions(encodedWordMetadata)));
}
public int positions() { return WordMetadata.decodePositions(encodedWordMetadata); }
public boolean isSpecial() { return keyword.contains(":") || hasTermFlag(EdgePageWordFlags.Synthetic); }
public boolean isRegular() {