1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//! VelesQL query execution for [`GraphCollection`].
use std::collections::HashMap;
use crate::collection::search::query::match_exec::MatchResult;
use crate::error::Result;
use crate::point::SearchResult;
use super::graph_collection::GraphCollection;
impl GraphCollection {
/// Executes a parsed `VelesQL` query.
///
/// # Errors
///
/// Returns an error if the query is invalid or execution fails.
pub fn execute_query(
&self,
query: &crate::velesql::Query,
params: &HashMap<String, serde_json::Value>,
) -> Result<Vec<SearchResult>> {
self.inner.execute_query(query, params)
}
/// Executes a query with instrumentation and returns plan + actual stats.
///
/// Delegates to [`crate::Database::explain_analyze_query`].
///
/// # Errors
///
/// Returns an error if the query is invalid or execution fails.
pub fn explain_analyze_query(
&self,
query: &crate::velesql::Query,
params: &HashMap<String, serde_json::Value>,
) -> Result<crate::velesql::ExplainOutput> {
self.inner.explain_analyze_query(query, params)
}
/// Executes a raw VelesQL string, parsing it before execution.
///
/// # Errors
///
/// - Returns an error if the SQL string cannot be parsed.
/// - Returns an error if query execution fails.
pub fn execute_query_str(
&self,
sql: &str,
params: &HashMap<String, serde_json::Value>,
) -> Result<Vec<SearchResult>> {
self.inner.execute_query_str(sql, params)
}
/// Executes a MATCH graph pattern query.
///
/// # Errors
///
/// Returns an error if the query cannot be executed.
pub fn execute_match(
&self,
match_clause: &crate::velesql::MatchClause,
params: &HashMap<String, serde_json::Value>,
) -> Result<Vec<MatchResult>> {
self.inner.execute_match(match_clause, params)
}
/// Executes a MATCH query with vector similarity scoring.
///
/// # Errors
///
/// Returns an error on dimension mismatch or execution failure.
pub fn execute_match_with_similarity(
&self,
match_clause: &crate::velesql::MatchClause,
query_vector: &[f32],
similarity_threshold: f32,
params: &HashMap<String, serde_json::Value>,
) -> Result<Vec<MatchResult>> {
self.inner.execute_match_with_similarity(
match_clause,
query_vector,
similarity_threshold,
params,
)
}
}