Find where a ranked search can stop.
RankFence merges ranked pages from search retrievers. It can stop fetching as soon as later pages cannot change the top results. A trusted shard map lets it close individual shards earlier.
Download Python wheelHistorical TREC rankings, partitioned into eight simulated shards. Pages of 16. The global coordinator read 78,956 IDs across 100 topics. Solving each shard independently and merging the scores took 206,934.
Run it locally
Install the wheel, then give each ranked stream its document namespace. Here two western retrievers agree on a winner. The eastern retrievers can still produce pages.
from rankfence import PartitionFence
f = PartitionFence(["W", "W", "E", "E"], k=1)
for i, ids in enumerate([["a"], ["a"], ["b", "c"], ["c", "b"]]):
f.push(i, ids)
assert f.ordered() == ("a",)Where it pays off
On four local TCP producers, paging helped when extra hits were expensive. With fast producers, one full-window request per source won.
12 TREC topics, three repeats. The expensive case adds 1 ms per request and 100 µs per hit. One-shot had the lowest p95 in all three tested scenarios.
Methodology and raw results