Skip to main content

parse_k_range

Function parse_k_range 

Source
pub fn parse_k_range(s: &str) -> Result<usize, String>
Expand description

Validates -k/--k for recall and hybrid-search to the inclusive range 1..=4096.

The upper bound matches the sqlite-vec knn limit; values above it would surface a leaky engine error such as k value in knn query too large, provided 10000 and the limit is 4096. Validating at parse time turns the failure into a clean Clap error before any database work.