[PATCH v5 05/12] reindex: drop all properties named with prefix "index."
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Sat Oct 14 23:48:00 PDT 2017
This allows us to create new properties that will be automatically set
during indexing, and cleared during re-indexing, just by choice of
property name.
---
lib/message.cc | 6 ++++++
lib/notmuch.h | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/lib/message.cc b/lib/message.cc
index 4ab0ed26..77bb6c76 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -1999,6 +1999,12 @@ notmuch_message_reindex (notmuch_message_t *message,
goto DONE;
}
+ ret = notmuch_message_remove_all_properties_with_prefix (message, "index.");
+ if (ret) {
+ INTERNAL_ERROR ("failed to remove index.* properties");
+ goto DONE;
+ }
+
/* re-add the filenames with the associated indexopts */
for (; notmuch_filenames_valid (orig_filenames);
notmuch_filenames_move_to_next (orig_filenames)) {
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 817f357f..fd6ead81 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -1765,6 +1765,12 @@ notmuch_message_destroy (notmuch_message_t *message);
* add or delete values for, as other subsystems or extensions may
* depend on these properties.
*
+ * Notmuch has some conventions about how certain properties are
+ * treated. Those conventions include:
+ *
+ * - preperties whose name begins with "index." are cleared (and
+ * possibly re-set) upon reindexing.
+ *
*/
/**@{*/
/**
--
2.14.2
More information about the notmuch
mailing list