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 | 6 ++++++ lib/notmuch.h | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/doc/man7/notmuch-properties.rst b/doc/man7/notmuch-properties.rst index ffaa2418..2ab4f3f4 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..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..01191a41 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: + * + * - properties whose name begins with "index." are cleared (and + * possibly re-set) upon reindexing. + * */ /**@{*/ /** -- 2.14.2 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch