shubhamvishu commented on code in PR #12653:
URL: https://github.com/apache/lucene/pull/12653#discussion_r1365181118


##########
lucene/core/src/java/org/apache/lucene/codecs/MultiLevelSkipListWriter.java:
##########
@@ -63,24 +63,23 @@ public abstract class MultiLevelSkipListWriter {
   /** for every skip level a different buffer is used */
   private ByteBuffersDataOutput[] skipBuffer;
 
+  /** Length of the window at which the skips are placed on skip level 1 */
+  private final long windowLength;
+
   /** Creates a {@code MultiLevelSkipListWriter}. */
   protected MultiLevelSkipListWriter(
       int skipInterval, int skipMultiplier, int maxSkipLevels, int df) {
     this.skipInterval = skipInterval;
     this.skipMultiplier = skipMultiplier;
 
-    int numberOfSkipLevels;
+    int numberOfSkipLevels = 1;
     // calculate the maximum number of skip levels for this document frequency
-    if (df <= skipInterval) {
-      numberOfSkipLevels = 1;
-    } else {
-      numberOfSkipLevels = 1 + MathUtil.log(df / skipInterval, skipMultiplier);
-    }
-
-    // make sure it does not exceed maxSkipLevels
-    if (numberOfSkipLevels > maxSkipLevels) {
-      numberOfSkipLevels = maxSkipLevels;
+    if (df > skipInterval) {
+      // also make sure it does not exceed maxSkipLevels
+      numberOfSkipLevels =
+          Math.min(1 + MathUtil.log(df / skipInterval, skipMultiplier), 
maxSkipLevels);
     }

Review Comment:
   Sure



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