Skip to content

feat: Implement Search Provider#6339

Merged
nathanlesage merged 14 commits into
developfrom
search-provider
Jun 5, 2026
Merged

feat: Implement Search Provider#6339
nathanlesage merged 14 commits into
developfrom
search-provider

Conversation

@nathanlesage

Copy link
Copy Markdown
Member

Description

This PR refactors the global search functionality and moves it mostly to the main process. This is done by creating a new provider for searches. The reason for this is that this allows us to implement stateful logic, including caching. This can allow us to provide better search experiences in the future which rely on pre-computed data (incl. vector search or BM25-variants).

Changes

Two crucial functions of the full text search have been removed from the renderer and moved to the new Search Provider: The compile-search-terms function and the actual searching action.

In addition, the entire search has been overhauled:

  • Clearly label it as a "boolean search" now
  • Fixed an issue that would finish a search in a file when all search terms were matched immediately. This would foreclose later matches in the same file.
  • Now searches are by default done only case-insensitive. Previously, the search would run twice, once in regular case, one in lower case. This cuts search times on average in half.
  • Users can now specify whether they want to actually run a case sensitive search.
  • Improved the terminology used throughout the search
  • Removed a bunch of odd and messy choices
  • Improve the search by combining results from the same file on the same line
  • No longer just provide the entire line as a result; instead now a window around the search match(es) is returned of about 40 characters by default, which can include additional context information
  • Moved some of the types of the search around to collocate them with the corresponding providers
  • Modularize the search to allow for the inclusion of different types of search in the future

Additional information

There currently still one iffy thing I'd like to address before merging: I found out while benchmarking that the search now is blazingly fast (good!) but this doesn't appear like such with the user, because the Vue reactivity adds so much overhead that a search that takes 0.5s visually takes ca. 4-5s until all elements are processed and rendered. There is lots of room for performance improvements here.

AI Disclosure Statement

No AI has been used whatsoever in crafting this PR. (The search functionality was all over the place and is many years old at this point, I think an AI would've had a hard time improving that as fast as I did.)

Tested on: macOS Tahoe 26.5

@nathanlesage nathanlesage linked an issue May 16, 2026 that may be closed by this pull request
5 tasks
@nathanlesage

Copy link
Copy Markdown
Member Author

@kyaso @benniekiss Anyone interested in giving this a quick sanity check? I've extensively tested this with my 10k notes library, and it works really, really well imo.

@benniekiss

Copy link
Copy Markdown
Collaborator

i'll take a look today and tomorrow!

@benniekiss

benniekiss commented May 19, 2026

Copy link
Copy Markdown
Collaborator

I was able to look this over, and nothing stands out to me as being an issue. I should be able to do some actual testing today to see about any performance improvements

@nathanlesage

Copy link
Copy Markdown
Member Author

Wonderful! Let me know when you're done :)

Comment thread source/win-main/GlobalSearch.vue Outdated
Comment thread source/win-main/GlobalSearch.vue
@nathanlesage

Copy link
Copy Markdown
Member Author

Did you have a chance to take another look? Or do you think that this is mergeable…?

@benniekiss

Copy link
Copy Markdown
Collaborator

I can look over it now, actually! I'll do some profiling as well

Comment thread source/app/service-providers/search/util/boolean-search.ts Outdated
Comment thread source/app/service-providers/search/util/boolean-search.ts
@nathanlesage

Copy link
Copy Markdown
Member Author

Good suggestions, thanks :) Anything else you could spot? Otherwise I'd say this is ready to merge! Any other improvements can also follow during the nightly testing…

@benniekiss

Copy link
Copy Markdown
Collaborator

This lgtm! I agree about further improvements in nightly :)

@nathanlesage

Copy link
Copy Markdown
Member Author

Perfect, thanks a bunch! :)

@nathanlesage nathanlesage merged commit 11c0b49 into develop Jun 5, 2026
3 checks passed
@nathanlesage nathanlesage deleted the search-provider branch June 5, 2026 09:06
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.

Full-Text Search Directory Filter Does Not Scroll

2 participants