facett-search — design note
Status: builds (egui 0.33) + 5 tests green. In ordning/crates/widgets/facett-search; destined for facett — but note the parser is reusable beyond the GUI (it's the ordning query language, used by search, the command line, saved views, boards, automation). It may ultimately live in ordning-core, with facett-search being just the egui bar over it.
What it is
parse(&str) -> Query— the ordning query-language parser (pure, no egui, heavily tested).SearchBar— an egui text input that parses-as-you-type and shows parsed clauses;take_submit()yields theQueryon Enter.
Grammar (manual ch.10)
attr:value · attr:a,b (OR) · -attr:value (exclude) · attr:lo..hi (range) · has:x / has:-x · #shortcut · sort:field / sort:field-desc · bare words = full-text. "quoted" and {braced} values group multi-word values (status:{In Progress}).
AST
struct Query { clauses: Vec<Clause>, text: Vec<String>, sort: Option<Sort> }
enum Clause { Eq{attr,values,negate}, Range{attr,lo,hi}, Has{attr,negate}, Shortcut{name} }
Design decisions
- Never fails — unrecognized tokens degrade to full-text terms, so a half-typed query is still usable (matches the "permissive, instant" UX bar).
- Tokenizer honors quotes/braces so multi-word values work.
QueryisSerialize→ it's the wire format between the bar, the engine, and saved views.WAS/CHANGEDhistory operators (manual ch.10) are the next parser addition — they need a small grammar extension (attr WAS value,attr CHANGED FROM x TO y).
Move-to-facett / TODO
- Promote
parse/Queryintoordning-core(shared by command line + automation); keep the bar here. - Autocomplete (field names, values, #shortcuts), simple/advanced mode toggle, saved-view dropdown.
- History operators + AST→SQL/index lowering (lives in
ordning-store).