From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id F1C286DE0350 for ; Fri, 20 Oct 2017 19:26:00 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.022 X-Spam-Level: X-Spam-Status: No, score=-0.022 tagged_above=-999 required=5 tests=[AWL=-0.022] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id j9vEh1pTsT6N for ; Fri, 20 Oct 2017 19:26:00 -0700 (PDT) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTP id 874536DE0A6C for ; Fri, 20 Oct 2017 19:25:59 -0700 (PDT) Received: from fifthhorseman.net (ool-6c3a0662.static.optonline.net [108.58.6.98]) by che.mayfirst.org (Postfix) with ESMTPSA id F2A33F99E for ; Fri, 20 Oct 2017 22:25:58 -0400 (EDT) Received: by fifthhorseman.net (Postfix, from userid 1000) id 3534120D1B; Fri, 20 Oct 2017 22:25:54 -0400 (EDT) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: [PATCH 03/12] reindex: drop all properties named with prefix "index." Date: Fri, 20 Oct 2017 22:25:40 -0400 Message-Id: <20171021022549.2724-4-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171021022549.2724-1-dkg@fifthhorseman.net> References: <20171021022549.2724-1-dkg@fifthhorseman.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Oct 2017 02:26:01 -0000 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. + * */ /**@{*/ /** -- 2.14.2