pub async fn search_vector(
conn: &Connection,
query_vec: &[f32],
model: &ModelName,
top_k: usize,
) -> Result<Vec<VectorSearchResult>>Expand description
Top-k nearest neighbours for query_vec under model (§5.9).
Goes through vector_top_k, which consults the DiskANN index, rather than
scanning the table and sorting: the index is what §9’s “top-10 over 100K
concepts in ≤20 ms” budget assumes, and an ORDER BY vector_distance_cos(…)
over the whole table is linear in the corpus no matter how small k is.
vector_top_k yields base-table rowids, so the distance is recomputed on the
k rows it selects — k distance evaluations, not one per concept.