]> git.notmuchmail.org Git - notmuch/blobdiff - lib/database.cc
database: Add "replyto" to the database schema documentation.
[notmuch] / lib / database.cc
index 07a2bdd60eac7a8b51dd8ceeda7de4791d1d6652..5b677d42007fcae27e2632701d2c4073a664e44b 100644 (file)
@@ -42,7 +42,8 @@ typedef struct {
  * Mail document
  * -------------
  * A mail document is associated with a particular email message file
  * Mail document
  * -------------
  * A mail document is associated with a particular email message file
- * on disk. It is indexed with the following prefixed terms:
+ * on disk. It is indexed with the following prefixed terms which the
+ * database uses to construct threads, etc.:
  *
  *    Single terms of given prefix:
  *
  *
  *    Single terms of given prefix:
  *
@@ -53,15 +54,14 @@ typedef struct {
  *
  *     thread: The ID of the thread to which the mail belongs
  *
  *
  *     thread: The ID of the thread to which the mail belongs
  *
+ *     replyto: The ID from the In-Reply-To header of the mail (if any).
+ *
  *    Multiple terms of given prefix:
  *
  *    Multiple terms of given prefix:
  *
- *     ref:    All unresolved message IDs from In-Reply-To and
- *             References headers in the message. (Once a referenced
- *             message is added to the database and the thread IDs
- *             are linked the corresponding "ref" term is dropped
- *             from the message document.)
+ *     reference: All message IDs from In-Reply-To and Re ferences
+ *                headers in the message.
  *
  *
- *     tag:    Any tags associated with this message by the user.
+ *     tag:       Any tags associated with this message by the user.
  *
  *    A mail document also has two values:
  *
  *
  *    A mail document also has two values:
  *
@@ -70,6 +70,11 @@ typedef struct {
  *
  *     MESSAGE_ID:     The unique ID of the mail mess (see "id" above)
  *
  *
  *     MESSAGE_ID:     The unique ID of the mail mess (see "id" above)
  *
+ * In addition, terms from the content of the message are added with
+ * "from", "to", "attachment", and "subject" prefixes for use by the
+ * user in searching. But the database doesn't really care itself
+ * about any of these.
+ *
  * Timestamp document
  * ------------------
  * A timestamp document is used by a client of the notmuch library to
  * Timestamp document
  * ------------------
  * A timestamp document is used by a client of the notmuch library to
@@ -104,7 +109,7 @@ typedef struct {
 
 prefix_t BOOLEAN_PREFIX_INTERNAL[] = {
     { "type", "T" },
 
 prefix_t BOOLEAN_PREFIX_INTERNAL[] = {
     { "type", "T" },
-    { "ref", "XREFERENCE" },
+    { "reference", "XREFERENCE" },
     { "replyto", "XREPLYTO" },
     { "timestamp", "XTIMESTAMP" },
 };
     { "replyto", "XREPLYTO" },
     { "timestamp", "XTIMESTAMP" },
 };
@@ -739,7 +744,8 @@ _notmuch_database_link_message_to_parents (notmuch_database_t *notmuch,
                                                             parent_message_id);
 
        if (parent_thread_id == NULL) {
                                                             parent_message_id);
 
        if (parent_thread_id == NULL) {
-           _notmuch_message_add_term (message, "ref", parent_message_id);
+           _notmuch_message_add_term (message, "reference",
+                                      parent_message_id);
        } else {
            if (*thread_id == NULL) {
                *thread_id = talloc_strdup (message, parent_thread_id);
        } else {
            if (*thread_id == NULL) {
                *thread_id = talloc_strdup (message, parent_thread_id);
@@ -773,7 +779,7 @@ _notmuch_database_link_message_to_children (notmuch_database_t *notmuch,
     notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;
     notmuch_private_status_t private_status;
 
     notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;
     notmuch_private_status_t private_status;
 
-    find_doc_ids (notmuch, "ref", message_id, &child, &children_end);
+    find_doc_ids (notmuch, "reference", message_id, &child, &children_end);
 
     for ( ; child != children_end; child++) {
 
 
     for ( ; child != children_end; child++) {
 
@@ -790,7 +796,7 @@ _notmuch_database_link_message_to_children (notmuch_database_t *notmuch,
            *thread_id = talloc_strdup (message, child_thread_id);
            _notmuch_message_add_term (message, "thread", *thread_id);
        } else if (strcmp (*thread_id, child_thread_id)) {
            *thread_id = talloc_strdup (message, child_thread_id);
            _notmuch_message_add_term (message, "thread", *thread_id);
        } else if (strcmp (*thread_id, child_thread_id)) {
-           _notmuch_message_remove_term (child_message, "ref",
+           _notmuch_message_remove_term (child_message, "reference",
                                          message_id);
            _notmuch_message_sync (child_message);
            ret = _merge_threads (notmuch, *thread_id, child_thread_id);
                                          message_id);
            _notmuch_message_sync (child_message);
            ret = _merge_threads (notmuch, *thread_id, child_thread_id);