keeferrourke / imgrep

A grep for images. Submission to Hack the North 2017.
https://devpost.com/software/imgrep
Other
24 stars 5 forks source link

remove db entries if file !exists #10

Closed keeferrourke closed 6 years ago

keeferrourke commented 7 years ago

imgrep init doesn't remove files from the db if they aren't found in subsequent scans of a directory

fix: keep file listing in memory when running files.Walker() and compare to db. ex:

fileListing := getFiles() // or whatever, just get a listing of the directory, k? string slice can be appended to as we run through Walker()
for _, f := 0 range file_listing {
     if !storage.IsInDB(f) {
          storage.Remove(f)
     }
}

or w/e

keeferrourke commented 7 years ago

related to #8

keeferrourke commented 7 years ago

Basically this issue is important to ensure we don't keep stale information hanging around.

keeferrourke commented 6 years ago

commit 30a593fed17f576a2a55b91fd8de4d714b116a5a fixes this issue; the db is cleaned up as results are returned to ensure that old/non-existent files do not appear in search results.