Skip to Content
Droot Developers

Smart Search on Other Pages

Opting a search page into smart search: its fields become filter chips, with Droot AI only where allowed.

Lists and boards read what's typed in their search box: typed syntax (amount<1000, status:unpaid, -stage:won) and plain words that the page's own fields explain ("unpaid over 1000", "this month") become filter chips, and the words left over stay the normal text search. Any other search page can do the same by describing its fields. Nothing is model-specific: the page says what it filters on, and the shared search input does the rest.

How a Page Opts In

A page passes a smart search contract to the shared input, SmartSearchInput (shell/components/ui/smart-search-input.tsx), in place of SearchInput. The contract is defined in shell/lib/search/smart-search.ts:

Property Required What it is
fields Yes The fields the page filters on (PublicFields, or the filter engine's schema fields): key, label, type, and options for a select
apply(conditions, text) Yes Applies a reading: the conditions to add to the page's filter, and the text left for its plain search
accept(condition) No The conditions the page can apply. A page whose filters are dropdowns takes "is" one value only; anything else is left out of the offer
ignore No Words that name the page itself ("Approvals"), which filter nothing
interpret No A server target that reads the words the rules couldn't explain with Droot AI (see below)
const smart = useMemo(() => ({
  fields: [statusField, typeField],
  accept: (c) => c.op === "is" && !c.not,
  apply: (conditions, text) => { setFilters(fromConditions(conditions)); setQuery(text); },
}), [statusField, typeField]);

<SmartSearchInput smart={smart} value={query} onChange={(e) => setQuery(e.target.value)} aria-label="Search" />

Typing still drives the page's own text search through onChange, exactly as before. When the rules find conditions on the page's fields, a dropdown offers Apply as filters, with each chip and the text left ("Apply as filters: Status is Overdue · and search 'metro'"). Enter or a click applies it through apply; Escape closes the offer, and a second Escape clears the box.

A page that passes no contract (or smart={null}) gets today's plain search box, unchanged.

Pages That Opt In

  • Setup tables. Every table whose filter bar (SetupFilters) has both a filter engine and a search opts in with the engine's own fields: app, record type, status, category and so on, as each table names them. Applied conditions join the table's chips, so the URL and saved filters keep them.
  • Approvals. Type, Company (when you work in more than one) and Status (Overdue, Ready to Approve, Delegated, in the Waiting On Me view) set the page's dropdowns. The Approvals search syntax (amount>10000, supplier:metro) names none of these fields, so it stays the text search.

Droot AI

Rules always work, with Droot AI off. AI is used only when both are true:

  1. The page names an interpret target in its contract.
  2. Droot AI's status has search on. It is on only when every switch allows AI in search: the application, the company, the role's Business Access policy and the person's own "Use AI in search" preference.

Even then, only the words the rules left unexplained are sent, with the page's field schema (labels, types and option labels), never a record's values. What comes back is kept only where the rules would write it: a declared field, an operator the field offers and a value it takes. If the call fails, the rules' reading stands. The model never runs the query; the person checks the chips and applies them.