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


##########
lucene/core/src/java/org/apache/lucene/search/MaxScoreCache.java:
##########
@@ -78,8 +85,15 @@ int getLevel(int upTo) throws IOException {
     return -1;
   }
 
+  float getMaxScoreForLevelZero() throws IOException {
+    return getMaxScoreForLevel(0);
+  }
+
   /** Return the maximum score for the given {@code level}. */
-  float getMaxScoreForLevel(int level) throws IOException {
+  private float getMaxScoreForLevel(int level) throws IOException {
+    if (level == -1) {
+      return globalMaxScore;
+    }

Review Comment:
   Nit: I think it'd be cleaner to have this `if` statement in `getMaxScore` 
instead since -1 is not a proper level, it is a way to mean "I don't have a 
level that provides information for scores up to this doc ID".



-- 
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