MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / extract_vector_arg

Function extract_vector_arg

nodedb-sql/src/planner/select/order_by/hybrid.rs:170–182  ·  view source on GitHub ↗

Extract the float-array from a `vector_distance(col, ARRAY[...])` expression.

(expr: &ast::Expr)

Source from the content-addressed store, hash-verified

168
169/// Extract the float-array from a `vector_distance(col, ARRAY[...])` expression.
170fn extract_vector_arg(expr: &ast::Expr) -> Result<Vec<f32>> {
171 Ok(match expr {
172 ast::Expr::Function(f) => {
173 let inner_args = extract_func_args(f)?;
174 if inner_args.len() >= 2 {
175 extract_float_array(&inner_args[1]).unwrap_or_default()
176 } else {
177 Vec::new()
178 }
179 }
180 _ => Vec::new(),
181 })
182}
183
184/// Extract the query string from a `bm25_score(col, 'query')` expression.
185fn extract_text_arg(expr: &ast::Expr) -> Result<String> {

Callers 2

plan_hybrid_two_sourceFunction · 0.85
plan_hybrid_tripleFunction · 0.85

Calls 3

extract_func_argsFunction · 0.85
extract_float_arrayFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected