aboutsummaryrefslogtreecommitdiffhomepage
path: root/database.cc
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2009-10-24 23:05:08 -0700
committerGravatar Carl Worth <cworth@cworth.org>2009-10-24 23:05:08 -0700
commit9ec68aa9c4694bdf1b948bb93299e0270ec071ae (patch)
tree93898f0e6ceb4a1a47c522bf17df9529464a00f6 /database.cc
parent65a272832e75a5bc8fbbc3e00ce25ae861787cce (diff)
Shuffle the value numbers around in the database.
First, it's nice that for now we don't have any users yet, so we can make incompatible changes to the database layout like this without causing trouble. ;-) There are a few reasons for this change. First, we now use value 0 uniformly as a timestamp for both mail and timestamp documents, (which lets us cleanup an ugly and fragile bare 0 in the add_value and get_value calls in the timestamp code). Second, I want to drop the thread value entirely, so putting it at the end of the list means we can drop it as compatible change in the future. (I almost want to drop the message-ID value too, but it's nice to be able to sort on it to get diff-able output from "notmuch dump".) But the thread value we never use as a value, (we would never sort on it, for example). And it's totally redundant with the thread terms we store already. So expect it to disappear soon.
Diffstat (limited to 'database.cc')
-rw-r--r--database.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/database.cc b/database.cc
index 928e91ba..aaad7105 100644
--- a/database.cc
+++ b/database.cc
@@ -588,7 +588,8 @@ notmuch_database_set_timestamp (notmuch_database_t *notmuch,
try {
status = find_timestamp_document (notmuch, db_key, &doc, &doc_id);
- doc.add_value (0, Xapian::sortable_serialise (timestamp));
+ doc.add_value (NOTMUCH_VALUE_TIMESTAMP,
+ Xapian::sortable_serialise (timestamp));
if (status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND) {
char *term = talloc_asprintf (NULL, "%s%s",
@@ -630,7 +631,7 @@ notmuch_database_get_timestamp (notmuch_database_t *notmuch, const char *key)
if (status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND)
goto DONE;
- ret = Xapian::sortable_unserialise (doc.get_value (0));
+ ret = Xapian::sortable_unserialise (doc.get_value (NOTMUCH_VALUE_TIMESTAMP));
} catch (Xapian::Error &error) {
goto DONE;
}