*
* 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.
+ * user in searching. Similarly, terms from the path of the mail
+ * message are added with a "folder" prefix. But the database doesn't
+ * really care itself about any of these.
*
* The data portion of a mail document is empty.
*
{ "from", "XFROM" },
{ "to", "XTO" },
{ "attachment", "XATTACHMENT" },
- { "subject", "XSUBJECT"}
+ { "subject", "XSUBJECT"},
+ { "folder", "XFOLDER"}
};
int
for ( ; i != end; i++) {
Xapian::TermIterator j;
+ notmuch_message_t *message;
+ notmuch_private_status_t private_status;
- document = find_document_for_doc_id (notmuch, *i);
+ message = _notmuch_message_create (local, notmuch,
+ *i, &private_status);
+ if (message == NULL)
+ return COERCE_STATUS (private_status,
+ "Inconsistent document ID in datbase.");
- document.remove_term (term);
+ _notmuch_message_remove_filename (message, filename);
+ _notmuch_message_sync (message);
+ /* Take care to find document after sync'ing filename removal. */
+ document = find_document_for_doc_id (notmuch, *i);
j = document.termlist_begin ();
j.skip_to (prefix);
db->delete_document (document.get_docid ());
status = NOTMUCH_STATUS_SUCCESS;
} else {
- db->replace_document (document.get_docid (), document);
status = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;
}
}