Folder-based searching

Carl Worth cworth at cworth.org
Sat Jan 15 14:46:53 PST 2011


I'm as sad as anyone to see that I let more than a month go by without
committing to the notmuch repository.

But I've just now committed the much-desired folder-based search
feature.

This should be a handy feature for people bringing mail in from a system
that stores information in the directories in which mail is stored, (one
common case is users fetching mail from gmail via imap---in this case
all gmail tags will be represented as directories).

Someone bringing in mail from such a system might want to migrate from
information in directory names to instead be information in notmuch
tags. That might look something like this:

	notmuch tag +important folder:important

Or it might be useful to run on several directories:

	for dir in *; do notmuch tag +"$dir"; folder:"$dir"; done

etc.

Please note that with the code in git currently, only newly incorporated
mail will be searchable via the "folder:" specification. So if you're
wanting to search your entire email collection, you may want to rebuild
your entire notmuch database. As a reminder, that process is something
like the following:

    notmuch dump > notmuch.dump
    rm -rf ~/mail/.notmuch	# Careful with this! Have backups in place!
    notmuch new			# Of course, this can take a long time
    notmuch restore notmuch.dump

Before the next release, I plan to increment the database version so
that users will be notified of the need to do an upgrade like this. (But
before I do that, I plan to implement a few more database changes---and
some of them are likely to be much more invasive than this one).

Have fun out there!

-Carl


More information about the notmuch mailing list