Lookup
Components
Fuse.js
- https://fusejs.io
- powers dendron fuzzy search
Logic
Query
The query logic for engine lookup has a bunch of special cases.
- if nothing is selected, show all the top level children
- special handling of wikilinks (will strip away wikilinks when searching)
- custom sorting logic depending on schemas
- etc.
Code
- common-all/src/fuse.ts
- queryNote
Lifecycle
Initialize the Index
For indexing, would use fusejs - this is the same indexing mechanism as we do for lookup.
Some incomplete pseudo code on how lookup indexes here: queryNotes
FuseEngine is initialized here: https://github.com/dendronhq/dendron/blob/dev/packages/engine-server/src/enginev2.ts#L88:L88
Code where we specify fields to index here
Refreshing the Index
When a note changes on disk, we use a fileWatcher to keep track of changes and we call updateNote to update the version of the note we have in the engine
Children
Backlinks