Skip to main content

rerank

Function rerank 

Source
pub async fn rerank<D: Directory + 'static>(
    searcher: &Searcher<D>,
    candidates: &[SearchResult],
    config: &RerankerConfig,
    final_limit: usize,
) -> Result<Vec<SearchResult>>
Expand description

Rerank L1 candidates by exact dense vector distance.

Groups candidates by segment for batched I/O, sorts flat indexes for sequential mmap access, and scores all vectors in a single SIMD batch per segment. Reuses buffers across segments to avoid per-candidate heap allocation.

When unit_norm is set in the config, scoring uses dot-product only (skips per-vector norm computation — ~40% less work).