Issue Summary
On the Inventory and Items (Parts/Materials/Tools/Consumables/Services) list screens, the search box only matches when the typed text appears as one contiguous substring of the record. A multi-word query whose words appear in a different order than the record's name never matches, and a trailing or leading space in the search box breaks matching entirely.
Steps to Reproduce
- Go to Inventory (or Items > Parts).
- Find or create an item named e.g.
Washer, Flat, M8.
- Type
M8 Washer into the search box.
- Also try
M8 Washer (trailing space) and M8 (single word, for comparison).
Actual Results
M8 Washer returns nothing, even though every word in the query appears in the item's name.
M8 Washer (trailing space) also returns nothing.
M8 alone works fine.
Expected Results
M8 Washer and M8 Washer should both return Washer, Flat, M8 — every word the user typed is present in the record, just in a different order. Carbon's own global (Cmd+K) search already behaves this way: it trims whitespace and matches on all words in any order (see packages/database/supabase/migrations/20260419140000_search-trigram-substring.sql).
Technical details
- Server-side query construction, not browser-specific. Each list service (
apps/erp/app/modules/inventory/inventory.service.ts, apps/erp/app/modules/items/items.service.ts) interpolates the whole search param into a single %...% PostgREST ilike pattern, so it can only match a contiguous substring, and nothing trims the value first.
Evidence
- Confirmed by reading the query construction directly — every affected function does
query.or(\name.ilike.%${args.search}%,...`)` with the raw, untrimmed string.
I have a small fix ready and will open a PR shortly.
Issue Summary
On the Inventory and Items (Parts/Materials/Tools/Consumables/Services) list screens, the search box only matches when the typed text appears as one contiguous substring of the record. A multi-word query whose words appear in a different order than the record's name never matches, and a trailing or leading space in the search box breaks matching entirely.
Steps to Reproduce
Washer, Flat, M8.M8 Washerinto the search box.M8 Washer(trailing space) andM8(single word, for comparison).Actual Results
M8 Washerreturns nothing, even though every word in the query appears in the item's name.M8 Washer(trailing space) also returns nothing.M8alone works fine.Expected Results
M8 WasherandM8 Washershould both returnWasher, Flat, M8— every word the user typed is present in the record, just in a different order. Carbon's own global (Cmd+K) search already behaves this way: it trims whitespace and matches on all words in any order (seepackages/database/supabase/migrations/20260419140000_search-trigram-substring.sql).Technical details
apps/erp/app/modules/inventory/inventory.service.ts,apps/erp/app/modules/items/items.service.ts) interpolates the wholesearchparam into a single%...%PostgRESTilikepattern, so it can only match a contiguous substring, and nothing trims the value first.Evidence
query.or(\name.ilike.%${args.search}%,...`)` with the raw, untrimmed string.I have a small fix ready and will open a PR shortly.