Skip to content

internal/refactor-note-loading #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

marcjulianschwarz
Copy link
Owner

@marcjulianschwarz marcjulianschwarz commented Apr 26, 2025

  • adds several tests that can be run with npm run test
    • with mocks for parts of the raycast API
    • with a nice temporary vault function
    • hopefully this will make the extension more maintainable and stable in the long run
  • improve memory usage
    • only load note title and path for search command
    • load note content lazily when note gets selected
    • load all note content once to create search index with MiniSearch package. Todo: update this index when note modified date changes
    • creating the minisearch index leads to memory overflow for the JS worker
  • fixes some bookmarking edge cases
  • fixes some plugins edge cases
    • moves plugin checking into own api service
    • adds unit test
  • extract preference parsing into own api service
  • daily note commands now additionally check for enabled daily note core plugin which is needed
  • use "blank note" text only when no default title is provided in the preferences
  • the QuickLook action can't be opened recursively anymore, once executed the QuickLook action will not be available in the actions

Todo

  • some actions don't correctly update the lists
  • search
  • fix search media command
  • add more tests

Issues

closes #111
closes #101
closes #93
closes #54

Possible Solutions for the search index

I am trying not to rely on third-party plugins/tools.

  1. Users don't need to install additional software
  2. We are independent of third-party tools and can add additional features

But, we are quite restricted with the memory limit. A possible solution would be third-party tools. For example, the popular Omnisearch Obsidian Plugin maintains its own minisearch index which can be queried with a local http service. This would also solve any sync issues between obsidian and Raycast.

@KevinBatdorf
Copy link
Collaborator

Another option. You could also create a custom index in a local SQLite db. With that you could also create vector embeddings to do semantic search as well.

@marcjulianschwarz
Copy link
Owner Author

marcjulianschwarz commented May 10, 2025

@KevinBatdorf I was looking into sqlite but I am not sure how to properly handle it. Simply installing better-sqlite3 does not work because native node addons are not supported yet, see raycast/extensions#135. Now apparently some people are using WASM compiled versions of sqlite (sql.js) as a workaround, but this will do everything in memory again which we can't do.

@KevinBatdorf
Copy link
Collaborator

That's right I forgot about that limitation. I wonder if you could write a simple wrapper in swift to use the native SQLite and just call the c functions on it. You wouldn't be able to add semantic search, but you could at least index the data.

@marcjulianschwarz marcjulianschwarz force-pushed the internal/refactor-note-loading branch from 9d8d5bb to 2b1cd13 Compare June 9, 2025 19:52
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.

Add unit tests Extension Rewrite JS Heap Out of Memory Issue When Searching for Notes or Creating New Notes
2 participants