Skip to main content

Module search

Module search 

Source
Expand description

The search loop: window-batched scoring with WAND pruning.

Structs§

Scratch
Reusable buffers for window scoring. Keep one per thread and pass it to search_with to avoid allocating on every query.
SearchOptions
Tunables of the search loop.

Constants§

MAX_WINDOW
Largest accepted SearchOptions::window: bounds the scratch buffers (4 M slots, 20 MB) whatever the caller asks for.

Functions§

search
Top-k search by dot product.
search_ids
Score only ids — sorted ascending, without duplicates — by seeking every lane to each of them, and offer the ones present in at least one lane to the sink. Cost O(|ids| × lanes × log): the path for a caller who already knows the candidates (a database pre-filter) when they are few against the postings a window search would walk. Scores are the same f32 sums as search_with: contributions added lane by lane in query order.
search_with
search with an explicit sink, options and scratch buffers.