(index) Fix bug where tcfFirstPosition lit up because one term was in the title and the other was missing from the document

This was because firstPosition calculation was not invalidated when positions were missing.
This commit is contained in:
Viktor Lofgren 2024-09-24 13:33:37 +02:00
parent 162fc25ebc
commit 3dec4b6b34

View File

@ -446,10 +446,13 @@ public class IndexResultScoreCalculator {
for (int i = 0; i < compiledQuery.size(); i++) { for (int i = 0; i < compiledQuery.size(); i++) {
if (positions[i] == null || !regularMask.get(i)) if (!regularMask.get(i))
continue; continue;
if (positions[i].isEmpty()) continue; if (positions[i] == null || positions[i].isEmpty()) {
firstPosition = Integer.MAX_VALUE;
continue;
}
firstPosition = Math.max(firstPosition, positions[i].getInt(0)); firstPosition = Math.max(firstPosition, positions[i].getInt(0));
searchableKeywordCount ++; searchableKeywordCount ++;