mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 05:18:58 +00:00
(index) Fix TCF bug where the ngram terms would be considered instead of the regular ones due to a logical derp
This commit is contained in:
parent
b80a83339b
commit
0dcca0cb83
@ -34,7 +34,11 @@ public class ResultRankingContext {
|
||||
this.ngramsMask = ngramsMask;
|
||||
|
||||
this.regularMask = new BitSet(ngramsMask.length());
|
||||
this.regularMask.xor(ngramsMask);
|
||||
for (int i = 0; i < ngramsMask.length(); i++) {
|
||||
if (!ngramsMask.get(i)) {
|
||||
regularMask.set(i);
|
||||
}
|
||||
}
|
||||
|
||||
this.fullCounts = fullCounts;
|
||||
this.priorityCounts = prioCounts;
|
||||
|
@ -14,6 +14,9 @@ public class TermCoherenceFactor {
|
||||
* found in the same sentences.
|
||||
*/
|
||||
public double calculateOverlap(CompiledQueryLong wordMetadataQuery) {
|
||||
if (wordMetadataQuery.size() <= 2)
|
||||
return 0;
|
||||
|
||||
long mask = CompiledQueryAggregates.longBitmaskAggregate(wordMetadataQuery,
|
||||
score -> score >>> WordMetadata.POSITIONS_SHIFT);
|
||||
|
||||
@ -62,7 +65,7 @@ public class TermCoherenceFactor {
|
||||
}
|
||||
}
|
||||
|
||||
if (cnt != 0) {
|
||||
if (cnt > 0) {
|
||||
return sum / cnt;
|
||||
} else {
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user