From 0bb05ff693737c5b91d6a64f6209984a6c418c46 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Fri, 20 Oct 2017 22:25:40 -0400 Subject: [PATCH] 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. --- doc/man7/notmuch-properties.rst | 6 ++++++ lib/message.cc | 4 ++++ lib/notmuch.h | 3 +++ 3 files changed, 13 insertions(+) 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. + * */ /**@{*/ /**