From: Carl Worth Date: Sun, 20 Dec 2009 23:46:41 +0000 (-0800) Subject: database: Store directory path in 'data' of directory documents. X-Git-Tag: 0.1~194 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=4c1cca888fc89cd5c072a2df609d6d6d47acdfaf database: Store directory path in 'data' of directory documents. We're planning to have mail documents refer to directory documents for the path of the containing directory. To support this, we need the path in the data, (since the path in the 'directory' term can be irretrievable as it will be the SHA1 sum of the path for a very long path). --- diff --git a/lib/database.cc b/lib/database.cc index bf56f520..dbfec630 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -87,12 +87,19 @@ typedef struct { * The directory document contains the following terms: * * directory: The directory path (relative to the database path) + * Or the SHA1 sum of the directory path (if the + * path itself is too long to fit in a Xapian + * term). + * * parent: The document ID of the parent directory document. * Top-level directories will have a parent value of 0. * * and has a single value: * * TIMESTAMP: The mtime of the directory (at last scan) + * + * The data portion of a directory document contains the path of the + * directory (relative to the datbase path). */ /* With these prefix values we follow the conventions published here: @@ -754,6 +761,8 @@ notmuch_database_set_directory_mtime (notmuch_database_t *notmuch, doc.add_term (term); talloc_free (term); + doc.set_data (path); + ret = _notmuch_database_find_parent_id (notmuch, path, &parent_id); if (ret)