summaryrefslogtreecommitdiff
path: root/source/net
diff options
context:
space:
mode:
authorLeo Treasure <leotreasure@gmail.com>2026-04-25 20:18:12 +0800
committerLeo Treasure <leotreasure@gmail.com>2026-04-25 20:18:12 +0800
commit7c0a00aad315a05194e1e075c36f80d21f3bcff4 (patch)
tree66f6a65373dc15a2f074c14a9042b7d4289bff71 /source/net
parent7b303b6f82b1eee57c05e984ce7f4f42fc992405 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'source/net')
-rw-r--r--source/net/yacy/search/query/SearchEvent.java2
1 files changed, 1 insertions, 1 deletions
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);