jpountz commented on code in PR #14511:
URL: https://github.com/apache/lucene/pull/14511#discussion_r2059900940


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene103/Lucene103PostingsReader.java:
##########
@@ -1286,14 +1298,11 @@ public long cost() {
 
           @Override
           public int numLevels() {
-            return indexHasFreq == false || level1LastDocID == NO_MORE_DOCS ? 
1 : 2;
+            return level1LastDocID == NO_MORE_DOCS ? 1 : 2;

Review Comment:
   I understand why this change helps, but this problem is not unique to term 
queries indexed with IndexOptions.DOCS, `ConstantScoreScorer` (used by many 
queries) causes the same problem. I'd rather fix the root cause than merge this 
workaround that we may forget to remove later.
   
   > Also, can this give incorrect results when norms are enabled ? Since, we 
are not reading the impacts.
   
   Impacts help compute upper bounds of the score over ranges of doc IDs. Since 
scores are required to not increase when the norm increases, a score computed 
with norm=1 will always be greater than or equal to a score computed with any 
other norm value. So this is correct, it may just return a score upper bound 
that is greater than the actual best score from the block.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to