Skip to content

arclabs561/qexpr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

qexpr

Typed query expressions (query algebra) for retrieval systems.

Semantics

  • Associativity: And/Or are n-ary and associative. Flattening is allowed.
  • Duplicates: And([A, A]) is semantically equivalent to And([A]) (set semantics), but the AST preserves them.
  • Empty: And([]) is True (universe); Or([]) is False (empty set).

What it is

This crate is intentionally not a parser. Parsing is product-specific. The goal here is a small, stable AST for query meaning that multiple systems can compile into their own execution plans.

Usage

[dependencies]
qexpr = "0.1.0"

Example:

use qexpr::{Near, Phrase, QExpr, Term};

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

qexpr::validate(&q).unwrap();

Development

cargo test

About

Query expression AST and utilities

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages