Global entity search
Status: ✅ Implemented
Intent
Section titled “Intent”Expert users navigate by entity, not by screen: “take me to Acme’s file”, not “Customers → search → Acme”. The command palette already jumps to menu entries; wiring your data into it turns it into the app’s front door.
Solution
Section titled “Solution”Implement GlobalSearchSupplier on the @UI app class:
@UIpublic class BackofficeApp implements GlobalSearchSupplier {
@Override public List<GlobalSearchResult> globalSearch(String searchText, HttpRequest httpRequest) { var hits = new ArrayList<GlobalSearchResult>(); customers.top(searchText, 5).forEach(c -> hits.add(new GlobalSearchResult(c.name(), c.taxId(), "/customers/" + c.id(), "Clientes"))); bookings.top(searchText, 5).forEach(b -> hits.add(new GlobalSearchResult(b.code(), b.guestName(), "/bookings/" + b.id(), "Reservas"))); return hits; }}- While the user types in the ⌘K palette, the menu results are joined (debounced) by the
matching entities, grouped by
category; arrow keys navigate across both; Enter (or click) navigates to the hit’sroute. - The palette calls the app-level
_globalsearchaction with the typedsearchText— per request, so results can be permission-scoped (resolve the user from the request). - Keep it fast: search indexes, top-N per category. The palette shows at most 8 hits.
Related
Section titled “Related”- Navigation & menus — the palette’s menu half
- Filters & Listing — when the answer is a slice, not a record