aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2017-10-20 22:25:40 -0400
committerDavid Bremner <david@tethera.net>2017-10-21 19:53:08 -0300
commit0bb05ff693737c5b91d6a64f6209984a6c418c46 (patch)
tree9d60840a70576b3f5f71decd0128205b5e79e62f
parent6575b7eb31a710c8215be698d5cf31be20d4356e (diff)
reindex: drop all properties named with prefix "index."
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.
-rw-r--r--doc/man7/notmuch-properties.rst6
-rw-r--r--lib/message.cc4
-rw-r--r--lib/notmuch.h3
3 files changed, 13 insertions, 0 deletions
diff --git a/doc/man7/notmuch-properties.rst b/doc/man7/notmuch-properties.rst
index 8654077c..f70ffb3c 100644
--- a/doc/man7/notmuch-properties.rst
+++ b/doc/man7/notmuch-properties.rst
@@ -41,6 +41,12 @@ Extensions to notmuch which make use of properties are encouraged to
report the specific properties used to the upstream notmuch project,
as a way of avoiding collisions in the property namespace.
+CONVENTIONS
+===========
+
+Any property with a key that starts with "index." will be removed (and
+possibly re-set) upon reindexing (see **notmuch-reindex(1)**).
+
SEE ALSO
========
diff --git a/lib/message.cc b/lib/message.cc
index 4ab0ed26..e819f27a 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -1999,6 +1999,10 @@ notmuch_message_reindex (notmuch_message_t *message,
goto DONE;
}
+ ret = notmuch_message_remove_all_properties_with_prefix (message, "index.");
+ if (ret)
+ goto DONE; /* XXX TODO: distinguish from other error returns above? */
+
/* 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 98f6e91a..2c5dcab5 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -1764,6 +1764,9 @@ notmuch_message_destroy (notmuch_message_t *message);
* add or delete values for, as other subsystems or extensions may
* depend on these properties.
*
+ * Please see notmuch-properties(7) for more details about specific
+ * properties and conventions around their use.
+ *
*/
/**@{*/
/**