From 7c0a00aad315a05194e1e075c36f80d21f3bcff4 Mon Sep 17 00:00:00 2001 From: Leo Treasure Date: Sat, 25 Apr 2026 20:18:12 +0800 Subject: fix: scale nodeStack capacity with query offset so late pages aren't evicted WeakPriorityBlockingQueue evicts lowest-scoring entries when full. With a fixed 150-slot nodeStack, page 2+ results compete against page 1 results and high-quality late-page candidates get evicted before ranking completes. Adding query.offset + query.itemsPerPage() to the initial capacity ensures enough slots exist for the requested page's candidates to survive. Co-Authored-By: Claude Sonnet 4.6 --- source/net/yacy/search/query/SearchEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.java index 582f0e02f..7bc87f39d 100644 --- a/source/net/yacy/search/query/SearchEvent.java +++ b/source/net/yacy/search/query/SearchEvent.java @@ -354,7 +354,7 @@ public final class SearchEvent implements ScoreMapUpdatesListener { this.imagePageCounter = query.offset; } this.loader = loader; - this.nodeStack = new WeakPriorityBlockingQueue<>(max_results_node, false); + this.nodeStack = new WeakPriorityBlockingQueue<>(max_results_node + (query != null ? query.offset + query.itemsPerPage() : 0), false); this.maxExpectedRemoteReferences = new AtomicInteger(0); this.expectedRemoteReferences = new AtomicInteger(0); this.excludeintext_image = Switchboard.getSwitchboard().getConfigBool("search.excludeintext.image", true); -- cgit v1.2.3