You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2024/09/12 14:21:24 UTC
(lucene) branch branch_9x updated: Lower number of hits in TestLargeNumHitsTopDocsCollector (#13775)
This is an automated email from the ASF dual-hosted git repository.
javanna pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 6cc4f13ab22 Lower number of hits in TestLargeNumHitsTopDocsCollector (#13775)
6cc4f13ab22 is described below
commit 6cc4f13ab2216c4207b4163123edda225d493525
Author: Luca Cavanna <ja...@apache.org>
AuthorDate: Thu Sep 12 16:19:22 2024 +0200
Lower number of hits in TestLargeNumHitsTopDocsCollector (#13775)
There's two tests where we use 250_000 as number of collected hits, but we only
ever index max 2000 docs. That makes use create a priority queue of size
250_000 for each segment partition which causes out of memory errors when the
number of partitions is higher than a few.
With this commit I propose that we lower the threshold to 2000 for those tests
that need a high number of collected hits. The assumption that a priority queue
is not built within the LargeNumHitsTopDocsCollector still holds so this change
should not defeat the purpose of the tests.
---
.../apache/lucene/sandbox/search/LargeNumHitsTopDocsCollector.java | 4 ++--
.../lucene/sandbox/search/TestLargeNumHitsTopDocsCollector.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lucene/sandbox/src/java/org/apache/lucene/sandbox/search/LargeNumHitsTopDocsCollector.java b/lucene/sandbox/src/java/org/apache/lucene/sandbox/search/LargeNumHitsTopDocsCollector.java
index e0f8ff6acff..d56984f7847 100644
--- a/lucene/sandbox/src/java/org/apache/lucene/sandbox/search/LargeNumHitsTopDocsCollector.java
+++ b/lucene/sandbox/src/java/org/apache/lucene/sandbox/search/LargeNumHitsTopDocsCollector.java
@@ -129,7 +129,7 @@ public final class LargeNumHitsTopDocsCollector implements Collector {
*/
protected void populateResults(ScoreDoc[] results, int howMany) {
if (pq != null) {
- assert totalHits >= requestedHitCount;
+ assert totalHits > requestedHitCount;
for (int i = howMany - 1; i >= 0; i--) {
results[i] = pq.pop();
}
@@ -137,7 +137,7 @@ public final class LargeNumHitsTopDocsCollector implements Collector {
}
// Total number of hits collected were less than requestedHitCount
- assert totalHits < requestedHitCount;
+ assert totalHits <= requestedHitCount;
Collections.sort(
hits,
Comparator.comparing((ScoreDoc scoreDoc) -> scoreDoc.score)
diff --git a/lucene/sandbox/src/test/org/apache/lucene/sandbox/search/TestLargeNumHitsTopDocsCollector.java b/lucene/sandbox/src/test/org/apache/lucene/sandbox/search/TestLargeNumHitsTopDocsCollector.java
index 42cd7e71b6b..82d8f5bd1df 100644
--- a/lucene/sandbox/src/test/org/apache/lucene/sandbox/search/TestLargeNumHitsTopDocsCollector.java
+++ b/lucene/sandbox/src/test/org/apache/lucene/sandbox/search/TestLargeNumHitsTopDocsCollector.java
@@ -105,7 +105,7 @@ public class TestLargeNumHitsTopDocsCollector extends LuceneTestCase {
IndexSearcher searcher = newSearcher(reader);
LargeNumHitsTopDocsCollector largeCollector = new LargeNumHitsTopDocsCollector(250_000);
TopScoreDocCollectorManager regularCollectorManager =
- new TopScoreDocCollectorManager(250_000, Integer.MAX_VALUE);
+ new TopScoreDocCollectorManager(reader.numDocs(), Integer.MAX_VALUE);
searcher.search(testQuery, largeCollector);
TopDocs topDocs = searcher.search(testQuery, regularCollectorManager);
@@ -135,7 +135,7 @@ public class TestLargeNumHitsTopDocsCollector extends LuceneTestCase {
IndexSearcher searcher = newSearcher(reader);
LargeNumHitsTopDocsCollector largeCollector = new LargeNumHitsTopDocsCollector(250_000);
TopScoreDocCollectorManager regularCollectorManager =
- new TopScoreDocCollectorManager(250_000, Integer.MAX_VALUE);
+ new TopScoreDocCollectorManager(reader.numDocs(), Integer.MAX_VALUE);
searcher.search(testQuery, largeCollector);
TopDocs topDocs = searcher.search(testQuery, regularCollectorManager);