Global search: adding filterer#373
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a global search and filter system for indexed results, providing functionality to search through ComponentNodes, WebPageNodes, and Collections with text filtering and root node type filtering capabilities.
- Implements a comprehensive filter system with text search and root node type filtering
- Adds a new search UI with input field and options menu for filter configuration
- Introduces result grouping and highlighting functionality for search matches
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
plugins/global-search/src/utils/object.ts |
Adds type-safe Object.entries utility and ReadonlyRecord type |
plugins/global-search/src/utils/indexer/types.ts |
Updates type definitions with readonly properties and renamed types |
plugins/global-search/src/utils/indexer/indexer.ts |
Updates type imports to use renamed IndexNodeRootNode type |
plugins/global-search/src/utils/filter/useFilter.ts |
Implements React hook for managing search filters and results |
plugins/global-search/src/utils/filter/types.ts |
Defines filter types, result types, and type guard functions |
plugins/global-search/src/utils/filter/ranges.ts |
Implements text range finding for search highlighting |
plugins/global-search/src/utils/filter/group-results.ts |
Groups search results by root node type and ID |
plugins/global-search/src/utils/filter/execute-filter.ts |
Core filter execution logic for text and root node filtering |
plugins/global-search/src/utils/assert.ts |
Adds assertion utilities for error handling |
plugins/global-search/src/components/ui/Menu.tsx |
Implements context menu component for filter options |
plugins/global-search/src/components/ui/IconSearch.tsx |
Search icon SVG component |
plugins/global-search/src/components/ui/IconEllipsis.tsx |
Ellipsis icon SVG component for menu trigger |
plugins/global-search/src/components/SearchScene.tsx |
Main search interface with results display |
plugins/global-search/src/components/SearchInput.tsx |
Search input field component |
plugins/global-search/src/components/DevToolsScene.tsx |
Updates dev tools UI configuration |
plugins/global-search/src/App.tsx |
Updates app to show search scene by default |
plugins/global-search/src/App.test.tsx |
Updates test to check for search interface |
a3a8314 to
faca97b
Compare
niekert
left a comment
There was a problem hiding this comment.
Nice one 👏
This filterer is not chunking the work nor is it caching results. If they seem to be needed and beneficial, this functionality comes in a follow-up.
Just FYI on a large project the Plugin freezes when you type a single character, so I think it would need something like that soon 🙏
niekert
left a comment
There was a problem hiding this comment.
Code LGTM. QA too 🙌
During QA I noticed:
- When you search for "Desktop" it matches a Frame Node named Desktop but it doesn't display the node in the result, so you see an empty header of the WebPage
- You have to restart the plugin for nodes added in the current scope while the plugin is active to be indexed
Not sure if already aware, can be followups ofc!
…display The UI is in large parts temporaty
Modified the App component to render SearchScene based on activeScene and adjusted the test to verify the presence of search interface elements.
2da546a to
f4e26a0
Compare
|
Thanks @niekert, I'm totally aware of both items you mentioned. The first will be covered in the UI coming next, while the "listen for changes" is something we can implement later - I'm unsure how long the plugin will be kept open that this is needed. |
Description
This PR will introduce the filter for indexed results, in addition to some rudimentary UI to show the results.
The results are grouped so they can be shown in context later on.
Note that the amber UI elements are not matching design specs. This PR is about the filter functionality, and the introduced elements are just enabling easy access to the functionality.
This filterer is not chunking the work nor is it caching results. If they seem to be needed and beneficial, this functionality comes in a follow-up.
Testing
...and un-select some; those root nodes are no longer in the result list.