suchnsuch / Tangent

The publicly-available modules of the Tangent project.
141 stars 8 forks source link

Queries not updating on file change #58

Closed mediapathic closed 4 months ago

mediapathic commented 6 months ago

I do a query for Notes named "foo" not with #bar. Query results are correct.

If I either rename files so they no longer contain foo, or remove the tag #bar from any of the relevant notes, and hit return on the query, the results remain the same, including the notes that should no longer be returned. This seems to persist until I edit the query in some way (in the test case, I deleted the not with #bar section of the query). EDIT: actually, just tested with a different case and editing the query in the same way did not update the query results.

taylorhadden commented 6 months ago

This is a known issue. There are two solutions for this. One is not very good and the other is complex enough that I gave it a firm kick down the road.

The solution I don't like is to invalidate all queries when any file is changed. This will definitely work, but the false-positive rate will be immense. To be fair, even full text search on moderately sized workspaces completes really quickly, so maybe this problem isn't as bad as I think.

The other, more complex option is to have queries register what kinds of things they're looking for, have file changes track those changes, and then invalidate queries accordingly. That would be a very complex bit of code. It would also likely be prone to false negatives in the early days.


That's a long way of me saying maybe I should just do the simple, easy, "wasteful" way. I could always invest more in the fancy way in the future.