Skip to main content

nearest_neighbor_sql

Function nearest_neighbor_sql 

Source
pub fn nearest_neighbor_sql(
    table: &str,
    column: &str,
    metric: DistanceMetric,
    param_index: usize,
    limit: usize,
    extra_columns: &[&str],
) -> String
Expand description

Generate a complete nearest-neighbor search query.

This generates SQL like:

SELECT *, embedding <-> $1 AS distance
FROM documents
ORDER BY distance
LIMIT 10