GNOME Bugzilla – Bug 760586
new files do not show up in global search results
Last modified: 2016-03-12 23:13:03 UTC
Upon creating a new file (or deleting a file), the global file search index is not updated. Originally, this was a technical issue. However, there is a fairly simple design to deal with this. "Tombstone records". We simply need to insert a tombstone when a file is deleted, and add the item when it is added. Support for tombstones should be added to fuzzy.c, which consists of an append with a bit used to mark that the item was "deleted". Search results should not add this to the result array.
I looks like I already added tombstone support to fuzzy.[ch], so fuzzy_remove() can be used to remove an item from the fuzzy index.
http://man7.org/tlpi/code/online/dist/inotify/inotify_dtree.c.html This supports all corner cases/race conditions very well, but it fails if the directory is very large (more than 4000 folders), with the error "inotify_add_watch: No space left on device". This uses the inotify API directly, I'm currently trying to make something that uses GFileMonitor instead.
Created attachment 323774 [details] [review] file-search: update index when new file is created by buffer-manager Long term, I think we want a better way to update the index when a file is added to the project. But to do that, we need to introduce some signals to IdeProject or similar structure (perhaps IdeContext). The easiest way to fix this bug for 3.20 is to watch for the new file being created by the buffer manager, since new files in the project tree get immediately opened.
Considering this bug fixed with the somewhat "workaround" oriented patch. We want to investigate better ways to propagate project-wide changes in the future. Attachment 323774 [details] pushed as 1a3795b - file-search: update index when new file is created by buffer-manager