Skip to content

Global search: adding filterer#373

Merged
elmarburke merged 4 commits intomainfrom
global-search/filterer
Aug 12, 2025
Merged

Global search: adding filterer#373
elmarburke merged 4 commits intomainfrom
global-search/filterer

Conversation

@elmarburke
Copy link
Copy Markdown
Contributor

@elmarburke elmarburke commented Aug 12, 2025

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.

image image

Testing

  • Filter by text works
    • Enter text in the search box, and you see matching results
  • Match ranges are correctly
    • Matching text is highlighted in the result
  • Root Node filters work
    • Hit the ... and un-select some; those root nodes are no longer in the result list.

@elmarburke elmarburke requested a review from Copilot August 12, 2025 10:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread plugins/global-search/src/utils/filter/execute-filter.ts Outdated
Comment thread plugins/global-search/src/utils/filter/ranges.ts Outdated
Comment thread plugins/global-search/src/components/SearchScene.tsx
@elmarburke elmarburke force-pushed the global-search/filterer branch from a3a8314 to faca97b Compare August 12, 2025 10:18
@elmarburke elmarburke marked this pull request as ready for review August 12, 2025 10:22
@elmarburke elmarburke changed the title Global search/filterer Global search: adding filterer Aug 12, 2025
@elmarburke elmarburke requested a review from niekert August 12, 2025 11:27
Copy link
Copy Markdown
Member

@niekert niekert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🙏

Comment thread plugins/global-search/src/components/SearchScene.tsx Outdated
Comment thread plugins/global-search/src/utils/filter/execute-filter.ts Outdated
Comment thread plugins/global-search/src/utils/filter/execute-filter.ts
Comment thread plugins/global-search/src/utils/filter/ranges.ts
Comment thread plugins/global-search/src/utils/filter/types.ts Outdated
Comment thread plugins/global-search/src/utils/filter/types.ts Outdated
@elmarburke elmarburke requested a review from niekert August 12, 2025 14:12
Copy link
Copy Markdown
Member

@niekert niekert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

image

Comment thread plugins/global-search/src/utils/filter/types.ts Outdated
Modified the App component to render SearchScene based on activeScene and adjusted the test to verify the presence of search interface elements.
@elmarburke elmarburke force-pushed the global-search/filterer branch from 2da546a to f4e26a0 Compare August 12, 2025 14:59
@elmarburke elmarburke added this pull request to the merge queue Aug 12, 2025
Merged via the queue into main with commit 2329c0e Aug 12, 2025
6 checks passed
@elmarburke elmarburke deleted the global-search/filterer branch August 12, 2025 15:11
@elmarburke
Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants