mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
(index) Fix term coherence evaluation
The code was incorrectly using the documentId instead of the combined id, resulting in almost all result sets being incorrectly seen as zero.
This commit is contained in:
parent
1748fcc5ac
commit
adf846bfd2
@ -64,7 +64,7 @@ public class IndexResultValuationContext {
|
||||
|
||||
long docId = UrlIdCodec.removeRank(combinedId);
|
||||
|
||||
if (!searchTerms.coherences.test(termMetadataForCombinedDocumentIds, docId))
|
||||
if (!searchTerms.coherences.test(termMetadataForCombinedDocumentIds, combinedId))
|
||||
return null;
|
||||
|
||||
long docMetadata = statefulIndex.getDocumentMetadata(docId);
|
||||
|
@ -15,9 +15,9 @@ public record TermCoherenceGroupList(List<TermCoherenceGroup> words) {
|
||||
this.words = Collections.unmodifiableList(words);
|
||||
}
|
||||
|
||||
public boolean test(TermMetadataForCombinedDocumentIds documents, long docId) {
|
||||
public boolean test(TermMetadataForCombinedDocumentIds documents, long combinedId) {
|
||||
for (var coherenceSet : words()) {
|
||||
if (!coherenceSet.test(documents, docId)) {
|
||||
if (!coherenceSet.test(documents, combinedId)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -36,11 +36,11 @@ public record TermCoherenceGroupList(List<TermCoherenceGroup> words) {
|
||||
this(coh.stream().mapToLong(SearchTermsUtil::getWordId).toArray());
|
||||
}
|
||||
|
||||
public boolean test(TermMetadataForCombinedDocumentIds documents, long docId) {
|
||||
public boolean test(TermMetadataForCombinedDocumentIds documents, long combinedId) {
|
||||
long overlap = 0xFF_FFFF_FFFF_FFFFL;
|
||||
|
||||
for (var word : words) {
|
||||
overlap &= documents.getTermMetadata(word, docId);
|
||||
overlap &= documents.getTermMetadata(word, combinedId);
|
||||
}
|
||||
|
||||
return WordMetadata.decodePositions(overlap) != 0L;
|
||||
|
Loading…
Reference in New Issue
Block a user