pub fn knn_search(
conn: &Connection,
embedding: &[f32],
namespace: &str,
memory_type: Option<&str>,
k: usize,
) -> Result<Vec<(i64, f32)>, AppError>Expand description
Runs a KNN search over vec_memories restricted to a namespace.
§Arguments
embedding— query vector of lengthcrate::constants::EMBEDDING_DIM.memory_type— optional filter on thetypecolumn.k— maximum number of hits to return.
§Returns
A vector of (memory_id, distance) pairs sorted by ascending distance.
§Errors
Returns Err(AppError::Database) on any rusqlite failure.