}
}
+
+/* Remove all terms generated by indexing, i.e. not tags or
+ * properties, along with any automatic tags*/
+notmuch_private_status_t
+_notmuch_message_remove_indexed_terms (notmuch_message_t *message)
+{
+ Xapian::TermIterator i;
+
+ const std::string
+ id_prefix = _find_prefix ("id"),
+ property_prefix = _find_prefix ("property"),
+ tag_prefix = _find_prefix ("tag"),
+ type_prefix = _find_prefix ("type");
+
+ for (i = message->doc.termlist_begin ();
+ i != message->doc.termlist_end (); i++) {
+
+ const std::string term = *i;
+
+ if (term.compare (0, type_prefix.size (), type_prefix) == 0)
+ continue;
+
+ if (term.compare (0, id_prefix.size (), id_prefix) == 0)
+ continue;
+
+ if (term.compare (0, property_prefix.size (), property_prefix) == 0)
+ continue;
+
+ if (term.compare (0, tag_prefix.size (), tag_prefix) == 0 &&
+ term.compare (1, strlen("encrypted"), "encrypted") != 0 &&
+ term.compare (1, strlen("signed"), "signed") != 0 &&
+ term.compare (1, strlen("attachment"), "attachment") != 0)
+ continue;
+
+ try {
+ message->doc.remove_term ((*i));
+ message->modified = TRUE;
+ } catch (const Xapian::InvalidArgumentError) {
+ /* Ignore failure to remove non-existent term. */
+ } catch (const Xapian::Error &error) {
+ notmuch_database_t *notmuch = message->notmuch;
+
+ if (!notmuch->exception_reported) {
+ _notmuch_database_log(_notmuch_message_database (message), "A Xapian exception occurred creating message: %s\n",
+ error.get_msg().c_str());
+ notmuch->exception_reported = TRUE;
+ }
+ return NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION;
+ }
+ }
+ return NOTMUCH_PRIVATE_STATUS_SUCCESS;
+}
+
/* Return true if p points at "new" or "cur". */
static bool is_maildir (const char *p)
{
talloc_free (folder);
+ message->modified = TRUE;
return NOTMUCH_STATUS_SUCCESS;
}