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


##########
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:
   It makes sense to me. I also added an assertion to just ensure the `level` 
parameter is not negative - if it happens it should be a bug but Java doesn't 
have unsigned int type - let me know if it isn't good.



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