HananoshikaYomaru / obsidian-3d-graph

👓 A 3D graph for Obsidian!
https://yomaru.dev
MIT License
116 stars 5 forks source link

consider using obsidian search as search engine when the concerns are fixed. #78

Open HananoshikaYomaru opened 6 months ago

HananoshikaYomaru commented 6 months ago

https://github.com/b-camphart/obsidian-search/issues/1

how search is done in 3d graph

passive search engine

  1. when the input value is change, the search result dom will be change
  2. there is a mutation observer to observe the dom change and get the result (this is in the FilterSettingView), it will change the search result in the graph setting manager
  3. the search result is a state in the graph setting manager. when it change, it push the change the search result changes which is also a state and call GrpahView.handleSearchResultChange
  4. the handleSearchResultChange is implemented separately by different graph view. For example in globalGraphView, it will call updateGraphData()

Problem

Therefore the search function is in the graph setting manager view. If the view is not init, the search function doesn't exist.

solution

the step 3 and 4 are good. The problem is the step 1 and step 2.

  1. we will solve the issue with passive search engine, even when we don't init the view, it should still perform an init search

to do this, we might need to extract the search function to a separte search feature just like the obsidian search and provide similar search api.

  1. when the search input change, debounce the search, call the search function and set the search result,