Skip to content

Item list search misses multi-word queries ("M8 Washer" doesn't find "Washer, Flat, M8") #1234

Description

@layne-sygnet

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

  1. Go to Inventory (or Items > Parts).
  2. Find or create an item named e.g. Washer, Flat, M8.
  3. Type M8 Washer into the search box.
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:groomedSpec + acceptance criteria proposed by the agent; safe to assign to carbon-agent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions