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.
This commit is contained in:
Daniel Kahn Gillmor 2017-10-20 22:25:40 -04:00 committed by David Bremner
parent 6575b7eb31
commit 0bb05ff693
3 changed files with 13 additions and 0 deletions

View 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, report the specific properties used to the upstream notmuch project,
as a way of avoiding collisions in the property namespace. 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 SEE ALSO
======== ========

View file

@ -1999,6 +1999,10 @@ notmuch_message_reindex (notmuch_message_t *message,
goto DONE; 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 */ /* re-add the filenames with the associated indexopts */
for (; notmuch_filenames_valid (orig_filenames); for (; notmuch_filenames_valid (orig_filenames);
notmuch_filenames_move_to_next (orig_filenames)) { notmuch_filenames_move_to_next (orig_filenames)) {

View file

@ -1764,6 +1764,9 @@ notmuch_message_destroy (notmuch_message_t *message);
* add or delete values for, as other subsystems or extensions may * add or delete values for, as other subsystems or extensions may
* depend on these properties. * depend on these properties.
* *
* Please see notmuch-properties(7) for more details about specific
* properties and conventions around their use.
*
*/ */
/**@{*/ /**@{*/
/** /**