Skip to content

Rewrite the spotlight search as a React component#33

Open
ramonski wants to merge 1 commit into
2.xfrom
2.x-react-spotlight
Open

Rewrite the spotlight search as a React component#33
ramonski wants to merge 1 commit into
2.xfrom
2.x-react-spotlight

Conversation

@ramonski

Copy link
Copy Markdown
Contributor

Description

Replaces the legacy Backbone/Underscore spotlight with a modern React component. React is consumed from the shared instance exposed by senaite.core (Webpack externals), so this bundle ships no React of its own.

Depends on senaite/senaite.core#2961 (exposes React/ReactDOM globally via vendor-react.js).

What is new

  • Control panel: a dedicated @@spotlight-controlpanel (registry backed, senaite.core: Manage Bika) to configure the hotkey, catalogs, commands, result limit, min chars, debounce and highlighting. Catalogs and commands are DataGridField grids; add-ons can append via their own registry.xml. A settings link is shown inside the spotlight to users with the permission.
  • Command palette: type / to list all commands (filtered by the user's permissions), /add to filter them.
  • Search syntax:
    • <prefix>:<term> scopes to a single catalog (e.g. s:water).
    • is:<state> filters by workflow state (e.g. s:CA20 is:received), with an autocomplete of the available states (segment-aware matching, so active does not match inactive).
  • Relevance ranking: the merged multi-catalog result set is ranked in Python by nearest match to the term, using brain metadata only so objects are only woken up for the results that are shown.
  • Standalone search page at @@spotlight-search (listing based) reachable from the spotlight, with catalog switcher tabs, filters, pagination and breadcrumb locations. Honors the same is: token and auto-runs from the spotlight's "Advanced search" link.
  • Look and feel: redesigned as a modern command palette with dark mode, match highlighting and keyboard navigation.

Robustness

  • Neutralizes the - operator so ids like WS-001 no longer collapse the ZCTextIndex search.
  • Treats empty control panel DataGrid cells (the <NO_VALUE> sentinel) as unset and ignores invalid/non-sortable sort_on indexes, handling catalog errors gracefully.

Upgrade

GenericSetup profile 2700 -> 2701 (registers the control panel, registry records and resources).

@ramonski ramonski force-pushed the 2.x-react-spotlight branch 7 times, most recently from a79e4f3 to 1cba25e Compare June 23, 2026 11:17
Replace the legacy Backbone/Underscore implementation with a modern React
component that consumes the shared React instance exposed by senaite.core via
Webpack externals (no bundled React copy).

Highlights:
- Dedicated control panel (hotkey, catalogs, commands, result limit,
  highlighting) backed by the registry, reachable from a settings link
- Command palette ("/") to navigate or trigger permission-filtered actions
- Catalog prefix scoping ("s:water"), content type narrowing and workflow
  state filtering ("is:received") with state autocomplete suggestions
- Relevance ranking over the mixed multi-catalog brain set, computed on brain
  metadata only so objects are woken up for the shown results only
- Standalone, listing based search page at "@@spotlight-search"
- Redesigned look and feel as a modern command palette with dark mode
@ramonski ramonski force-pushed the 2.x-react-spotlight branch from 1cba25e to b12ba2b Compare June 23, 2026 11:44
@ramonski ramonski requested a review from xispa June 23, 2026 12:47
@ramonski ramonski added the Enhancement ✨ Improvement to existing functionality label Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement ✨ Improvement to existing functionality

Development

Successfully merging this pull request may close these issues.

1 participant