You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/11/29 04:27:41 UTC

[GitHub] [lucene] costin opened a new pull request, #11984: Add exponential growth to TimeLimitingBulkScorer

costin opened a new pull request, #11984:
URL: https://github.com/apache/lucene/pull/11984

   Fix #11676


-- 
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-unsubscribe@lucene.apache.org

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


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


[GitHub] [lucene] dnhatn commented on pull request #11984: Add exponential growth to TimeLimitingBulkScorer

Posted by GitBox <gi...@apache.org>.
dnhatn commented on PR #11984:
URL: https://github.com/apache/lucene/pull/11984#issuecomment-1335560505

   Thanks @costin!


-- 
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-unsubscribe@lucene.apache.org

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


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


[GitHub] [lucene] costin commented on pull request #11984: Add exponential growth to TimeLimitingBulkScorer

Posted by GitBox <gi...@apache.org>.
costin commented on PR #11984:
URL: https://github.com/apache/lucene/pull/11984#issuecomment-1332462998

   > LGTM. Can you add a CHANGES entry under 9.5?
   
   Done.


-- 
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-unsubscribe@lucene.apache.org

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


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


[GitHub] [lucene] dnhatn merged pull request #11984: Add exponential growth to TimeLimitingBulkScorer

Posted by GitBox <gi...@apache.org>.
dnhatn merged PR #11984:
URL: https://github.com/apache/lucene/pull/11984


-- 
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-unsubscribe@lucene.apache.org

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


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


[GitHub] [lucene] jpountz commented on a diff in pull request #11984: Add exponential growth to TimeLimitingBulkScorer

Posted by GitBox <gi...@apache.org>.
jpountz commented on code in PR #11984:
URL: https://github.com/apache/lucene/pull/11984#discussion_r1034826332


##########
lucene/core/src/test/org/apache/lucene/search/TestTimeLimitingBulkScorer.java:
##########
@@ -62,6 +66,44 @@ public void testTimeLimitingBulkScorer() throws Exception {
     directory.close();
   }
 
+  public void testExponentialRate() throws Exception {
+    var bulkScorer =
+        new BulkScorer() {
+          int expectedInterval = TimeLimitingBulkScorer.INTERVAL;
+          int lastInterval = 0;
+          int runs = TestUtil.nextInt(random(), 1, 100);
+
+          @Override
+          public int score(LeafCollector collector, Bits acceptDocs, int min, int max)
+              throws IOException {
+            var difference = max - min;
+            // the rate shouldn't overflow - only increase or remain equal
+            assertTrue("Rate should only go up", difference >= lastInterval);
+            assertEquals("Incorrect rate encountered", expectedInterval, difference);
+
+            lastInterval = difference;
+            // use integer sum since the exponential growth formula yields different result due to
+            // rounding
+            expectedInterval = expectedInterval + expectedInterval / 2;
+            // overflow - stop at the previous one
+            if (expectedInterval < 0) {
+              expectedInterval = lastInterval;
+            }
+            // keep going or finish the test?
+            return --runs == 0 ? DocIdSetIterator.NO_MORE_DOCS : 0;

Review Comment:
   Why would we end prematurely instead of doing the checks on the full range? Is it to avoid the corner case of the last range, which might be smaller than the expected interval? Maybe the bulk scorer could record the  segment's `maxDoc` and allow the difference to be less than `expectedInterval` if the `max` doc is equal to `maxDoc`?



-- 
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-unsubscribe@lucene.apache.org

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


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