Skip to content

Rust SDK

Use qql-core when your service needs a transport-free parser and AST. Add qql when the same process should execute plans against Qdrant.

Install parser and runtime
cargo add qql-core qql
QQLTenant-scoped product searchTry in playground
QUERY TEXT 'laptops'
FROM products
USING dense
LIMIT 10;

The parser requires complete input. Retain the typed Stmt and rewrite that object before planning or execution. The Filter injection guide details how the injected predicate lands in each statement type.

use qql_core::ast::{inject_filter, ComparisonOp, Value};
use qql_core::parser::Parser;
let mut stmt = Parser::parse(query)?;
inject_filter(
&mut stmt,
"tenant_id",
ComparisonOp::Eq,
Value::Str("org_99".into()),
)?;
// Optional request routing. This is not tenant isolation.
stmt.set_shard_key(Some("org_99".into()));

Executor::execute accepts one QQL source string. Use OnError::Stop to halt at the first failure or OnError::Continue to collect a report for every statement in a script.

use qql::executor::{Executor, OnError};
let executor = Executor::rest("http://localhost:6333", None)?;
let report = executor.execute(query, OnError::Stop).await?;
assert!(report.ok);
println!("{} operations succeeded", report.succeeded);

For text input, configure an embedder or provide a QUERY VECTOR / explicit vector value. The runtime also exposes Executor::grpc behind its gRPC feature.

Parser::parsefn(&str) -> Result<Stmt, QqlError>
required

Parse exactly one complete statement.

Parser::parse_allfn(&str) -> Result<Vec<Stmt>, QqlError>
required

Parse one semicolon-delimited script.

inject_filterfn(&mut Stmt, &str, ComparisonOp, Value) -> Result<(), QqlError>
required

Add a trusted predicate to a parsed statement.

Executor::executeasync fn(&self, &str, OnError) -> Result<ExecutionReport>
required

Plan and execute one statement or a script against the configured backend.

SurfaceFunction or typePurpose
ParseParser::parse, Parser::parse_allStrict single-statement or script parsing
Inspectlexer::Lexer, explain, explain_allTokens and human-readable AST explanation
Rewriteinject_filter, Stmt::set_shard_keyTrusted AST mutation before planning
Planqql_plan::plan::plan, to_rest_routeOffline IR and Qdrant REST projection
ExecuteExecutor::execute, execute_batch, execute_nodeSource, batch, or owned-statement execution
EmbedEmbedder, resolve_embeddingsResolve text, sparse, multi, image, or rerank inputs

For offline route inspection, use qql_plan::plan::plan followed by qql_plan::plan::to_rest_route before configuring any transport.