RankFence

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 wheel

Retrieval replay

80.26%entries skipped
100/100topics stopped early
100/100match exhaustive
Share of each topic read100%
One column per query0%

Historical 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.

Expensive producer · RankFence p5045.5 ms
Expensive producer · one-shot p50106.4 ms
No delay · RankFence / one-shot p503.0 / 2.8 ms

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