Summary
pymat.search(query: str, *, limit: int = 10) -> list[Material] as a top-level fuzzy-find over the loaded library. Complements pymat.vis.search(...) (visual catalog) with a symmetric domain-side verb.
Design
Tokenized + weighted-target matching over a flat registry — grades, variants, vendors are already first-class:
- registry key: weight 10
Material.name / grade: weight 5
- hierarchy parent names: weight 3
All tokens must match somewhere (conjunctive). Ties broken by shorter key.
Triggers load_all() so results are exhaustive. Case-insensitive.
Examples
pymat.search("stainless") # → [stainless, s304, s316L, ...]
pymat.search("316") # → [s316L, s316, ...]
pymat.search("stainless 316") # → [s316L] # all tokens must match
pymat.search("lyso ce saint") # → [prelude420, ...] # deep hierarchy
Out of scope for v1
- Scoped search (
kind="grade" / kind="parent") — optional follow-up.
- Aliases / synonyms — punt.
- Levenshtein via
rapidfuzz — substring + token is enough. Optional extra later if needed.
- Property filters (
"density > 8") — different API.
Related
Summary
pymat.search(query: str, *, limit: int = 10) -> list[Material]as a top-level fuzzy-find over the loaded library. Complementspymat.vis.search(...)(visual catalog) with a symmetric domain-side verb.Design
Tokenized + weighted-target matching over a flat registry — grades, variants, vendors are already first-class:
Material.name/grade: weight 5All tokens must match somewhere (conjunctive). Ties broken by shorter key.
Triggers
load_all()so results are exhaustive. Case-insensitive.Examples
Out of scope for v1
kind="grade"/kind="parent") — optional follow-up.rapidfuzz— substring + token is enough. Optional extra later if needed."density > 8") — different API.Related