bayleeadamoss / zazu-file-finder

A file finder for Zazu.
18 stars 11 forks source link

Too slow finding files #22

Open Menci opened 7 years ago

Menci commented 7 years ago

The command locate runs much faster then this plugin.

Maybe we can adapt the locate command, or maintain a local file index cache?

bayleedev commented 7 years ago

Originally this had a file cache, but there were a lot of issues with maintaining it.

If we go back to a cache we'd need a few things

Locate searches everything, so we could filter the results once we have them, but it only updates daily or weekly and doesn't appear to have a way to force update it. Likely because it's indexing the entire file system.

twang2218 commented 7 years ago

I will work on this issue, fileFinder seems cost several minutes to complete, which too long to use without caching. So, I think the cache database is necessary here.

How about using fs.watch for short term file updates, and scan the directories for every hour or every certain times to regenerate the whole database?

bayleedev commented 7 years ago

@twang2218 Right now @afaur is working on a rewrite to make an "adapter" pattern, which should be done this weekend. This should allow more patterns to emerge like the one you are talking about.

The issue with the fs.watch is the number of files. For example on smaller hard drives (like mine) the file finder is quick so there's no need for a cache. A larger hard drive (like @afaur 's haha) takes longer, but the "cache" would be huge as well. Caching the files was actually the first approach we took in making the file finder, but the file cache was over 1GB, so a huge watch! :o

The pattern that @afaur is trying to implement is mdfind (for osx), but once it's done we can also make a locate one and a few others for os specific things. [:

bayleedev commented 7 years ago

Since the adapter is merged in now, if anybody wants to make a locate adapter, now is your chance :D

natew commented 6 years ago

Just curious, this is replacing mdfind with locate right? Is locate really that much faster than mdfind?

bayleedev commented 6 years ago

I wouldn't replace mdfind with locate, but I'd accept it as another adapter people can pick from.