feat: Implement Search Provider#6339
Conversation
|
@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. |
|
i'll take a look today and tomorrow! |
|
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 |
|
Wonderful! Let me know when you're done :) |
|
Did you have a chance to take another look? Or do you think that this is mergeable…? |
|
I can look over it now, actually! I'll do some profiling as well |
|
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… |
|
This lgtm! I agree about further improvements in nightly :) |
|
Perfect, thanks a bunch! :) |
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:
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