qexpr 0.1.0

Typed query expressions (query algebra) for retrieval systems.
Documentation
  • Coverage
  • 100%
    32 out of 32 items documented0 out of 15 items with examples
  • Size
  • Source code size: 25.2 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.14 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • arclabs561/qexpr
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • arclabs561

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