Use qql-core when your service needs a transport-free parser and AST. Add qql when the same process should execute plans against Qdrant.
cargo add qql-core qqlQUERY TEXT 'laptops'FROM productsUSING denseLIMIT 10;Parse once, then enforce policy
Section titled “Parse once, then enforce policy”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()));Execute a statement or script
Section titled “Execute a statement or script”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.
Core API
Section titled “Core API”Parse exactly one complete statement.
Parse one semicolon-delimited script.
Add a trusted predicate to a parsed statement.
Plan and execute one statement or a script against the configured backend.
| Surface | Function or type | Purpose |
|---|---|---|
| Parse | Parser::parse, Parser::parse_all | Strict single-statement or script parsing |
| Inspect | lexer::Lexer, explain, explain_all | Tokens and human-readable AST explanation |
| Rewrite | inject_filter, Stmt::set_shard_key | Trusted AST mutation before planning |
| Plan | qql_plan::plan::plan, to_rest_route | Offline IR and Qdrant REST projection |
| Execute | Executor::execute, execute_batch, execute_node | Source, batch, or owned-statement execution |
| Embed | Embedder, resolve_embeddings | Resolve 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.