Skip to main content

MAX_TOP_K

Constant MAX_TOP_K 

Source
pub const MAX_TOP_K: usize = 100_000;
Expand description

Upper bound on top_k accepted anywhere a search request enters the system (JNI C-ABI, ailake-query::scanner, CLI, Python bindings). top_k flows into ef.max(top_k * 10) in ailake-index’s HNSW search and then a BinaryHeap::with_capacity sized off that — an unvalidated huge top_k requests a multi-GB allocation whose failure aborts the process. Single source of truth so every entry point enforces the same limit.