reindex: drop all properties named with prefix "index."
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Sat, 21 Oct 2017 02:25:40 +0000 (22:25 -0400)
committerDavid Bremner <david@tethera.net>
Sat, 21 Oct 2017 22:53:08 +0000 (19:53 -0300)
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
lib/message.cc
lib/notmuch.h

index 8654077c1f6983a371b1dbe9fbf764f6d67e5fe1..f70ffb3ca3ae706b7f74393eb48b1f0d6375d93d 100644 (file)
@@ -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
 ========
 
index 4ab0ed269fd0bca5ce83142aeb97a718a5a1bdc8..e819f27a40da831a0371b03fc8f56b938dabb8e2 100644 (file)
@@ -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)) {
index 98f6e91a60e940426be88e38d1faff805182c021..2c5dcab5e6a0b00f2cf48e4f69d37a7c289c2484 100644 (file)
@@ -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.
+ *
  */
 /**@{*/
 /**