ugrep-indexer icon indicating copy to clipboard operation
ugrep-indexer copied to clipboard

Configurable `._UG#_Store` location

Open mattalxndr opened this issue 6 months ago • 1 comments

Having a hidden ._UG#_Store file saved to every single directory I'm indexing has too many side effects for me. I'd need to reconfigure so many other tools to ignore them (syncthing, git, other search tools, btrfs snapshots, etc).

It would be a lot easier if I could keep them in an alternate root. Perhaps I'd configure index-root=.ugrep-index/ and then a search of ./path/to/files/ would read ./.ugrep-index/path/to/files/. The index root would contain nothing but index files, separated from the files they reference.

mattalxndr avatar May 11 '25 08:05 mattalxndr

I have this on my TODO list.

Having localized index files has an advantage, however, because it guarantees that the index-based search never returns wrong results (no information loss). Even when one or more local index files are stale (not timely updated), updated files are always searched. This is done by comparing the OS-created file time stamps for the ._UG#_Store index files and indexed files.

It is technically possible to do with a central index file using some tricks to guarantee absence of information loss (files are always searched when indexes are stale or absent), but this puts the burden on the user to specify the index file or index file location. Perhaps that can be done in the .ugrep-indexer configuration file, which is consulted when present in the working directory where ugrep-indexer is run and, likewise, when ugrep --index is run, which in this case must be done in the same directory where .ugrep-indexer is located. Or perhaps ugrep --index=INDEXFILE would work, although that requires memorizing INDEXFILE. All of these concerns are not a problem with local ._UG#_Store index files that ugrep --index simply finds on the fly, wherever they are.

genivia-inc avatar May 14 '25 17:05 genivia-inc