Thanks to visit codestin.com
Credit goes to lib.rs

#query-planning #ast #retrieval #query-ast #ir

qplan

Compile a typed query AST (qexpr) into execution-friendly plans (prime-ideal: planning)

1 unstable release

0.1.0 Mar 17, 2026

#2305 in Text processing


Used in lexir

MIT/Apache

9KB
145 lines

qplan: query planning / compilation for retrieval.

qexpr describes query meaning; qplan compiles that meaning into a small plan that execution backends can implement efficiently.

This crate is intentionally narrow today: it only supports a conjunctive subset of QExpr (terms, phrases, NEAR constraints, and AND trees) and returns explicit errors for the rest.


qplan

Compile typed query expressions (qexpr) into execution-friendly query plans.

This crate is intentionally narrow today: it supports compiling a subset of QExpr into a conjunctive plan (AND of terms/phrases/near constraints). Unsupported operators return explicit errors so downstream systems can choose a fallback.

Usage

[dependencies]
qplan = { git = "https://github.com/arclabs561/qplan" }

Example:

use qexpr::{Phrase, QExpr, Term};
use qplan::compile_conjunctive;

let q = QExpr::And(vec![
    QExpr::Term(Term::new("alpha")),
    QExpr::Phrase(Phrase::new(vec![Term::new("new"), Term::new("york")])),
]);

let p = compile_conjunctive(&q).unwrap();
assert!(!p.bag_terms.is_empty());

Development

cargo test

Dependencies

~125–485KB
~11K SLoC