mirror of
https://github.com/Donkie/Spoolman.git
synced 2026-10-22 10:02:17 -05:00
The search treated the whole query as one substring match, so "bambu petg-cf" had to appear verbatim in a single field and returned nothing, even though "bambu" and "petg-cf" each matched on their own. Vendor-name matching also ran as a separate query, so a term could never be satisfied by the vendor while another was satisfied by the filament. Split the query on whitespace and require every term to match some searchable field, letting different terms match different fields: - Filaments search vendor.name in the same pass as their own fields via an outerjoin, replacing the separate vendor query. This is what makes "bambu petg-cf" work. - Extra-field matching moves from a follow-up query to a correlated EXISTS inside each term's OR-clause, so extras participate in the AND too. - Ranking generalizes to a per-field-kind base rank (native 0, vendor 2, extra 4) with prefix hits beating substrings. A row ranks by its worst term, so rows matching everything strongly sort first; the reported match_field is the single best hit. Single-term queries behave as before. Standard SQL only (ilike, correlated EXISTS), so this holds on all four supported databases. Claude-Session: https://claude.ai/code/session_014Cwk5Yyze9yPvkYkUtMAP4