Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/135767.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 135767
summary: Pass fix size instead of `maxPageSize` to `LuceneTopNOperator` scorer
area: ES|QL
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ public String describe() {
}
}

// We use the same value as the INITIAL_INTERVAL from CancellableBulkScorer
private static final int NUM_DOCS_INTERVAL = 1 << 12;

private final CircuitBreaker breaker;
private final List<SortBuilder<?>> sorts;
private final long estimatedPerRowSortSize;
Expand Down Expand Up @@ -202,7 +205,7 @@ private Page collect() throws IOException {
perShardCollector = newPerShardCollector(scorer.shardContext(), sorts, needsScore, limit);
}
var leafCollector = perShardCollector.getLeafCollector(scorer.leafReaderContext());
scorer.scoreNextRange(leafCollector, scorer.leafReaderContext().reader().getLiveDocs(), maxPageSize);
scorer.scoreNextRange(leafCollector, scorer.leafReaderContext().reader().getLiveDocs(), NUM_DOCS_INTERVAL);
} catch (CollectionTerminatedException cte) {
// Lucene terminated early the collection (doing topN for an index that's sorted and the topN uses the same sorting)
scorer.markAsDone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ public void testTaskContentsForTopNQuery() throws Exception {
try {
getTasksStarting();
logger.info("unblocking script");
scriptPermits.release(pageSize());
scriptPermits.release(numberOfDocs() + pageSize());
List<TaskInfo> tasks = getTasksRunning();
String sortStatus = """
[{"pause_me":{"order":"asc","missing":"_last","unmapped_type":"long"}}]""";
Expand Down