From 5caff2f97e194d72837fbcd3b110f3d686ca13b7 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Mon, 18 Jul 2016 01:44:27 +0200 Subject: [PATCH] Re: [PATCH] add has: query prefix to search for specific properties --- c1/cfdbfaa3448c4a3168c315340dc361da223de1 | 95 +++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 c1/cfdbfaa3448c4a3168c315340dc361da223de1 diff --git a/c1/cfdbfaa3448c4a3168c315340dc361da223de1 b/c1/cfdbfaa3448c4a3168c315340dc361da223de1 new file mode 100644 index 000000000..9ca340d15 --- /dev/null +++ b/c1/cfdbfaa3448c4a3168c315340dc361da223de1 @@ -0,0 +1,95 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 836216DE01F9 + for ; Sun, 17 Jul 2016 16:44:37 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[AWL=0.000] + 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 xBo_lWzYjXG3 for ; + Sun, 17 Jul 2016 16:44:29 -0700 (PDT) +Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) + by arlo.cworth.org (Postfix) with ESMTP id 706596DE01CE + for ; Sun, 17 Jul 2016 16:44:29 -0700 (PDT) +Received: from fifthhorseman.net (p4FCDEE1A.dip0.t-ipconnect.de + [79.205.238.26]) + by che.mayfirst.org (Postfix) with ESMTPSA id C930B1037F; + Sun, 17 Jul 2016 19:44:28 -0400 (EDT) +Received: by fifthhorseman.net (Postfix, from userid 1000) + id 9C6B41FF54; Mon, 18 Jul 2016 01:44:27 +0200 (CEST) +From: Daniel Kahn Gillmor +To: David Bremner , Notmuch Mail +Subject: Re: [PATCH] add has: query prefix to search for specific properties +In-Reply-To: <87ziphxfl2.fsf@zancas.localnet> +References: <1465779955-5539-9-git-send-email-david@tethera.net> + <1467969336-7605-1-git-send-email-dkg@fifthhorseman.net> + <87ziphxfl2.fsf@zancas.localnet> +User-Agent: Notmuch/0.22+77~gaba8744 (https://notmuchmail.org) Emacs/24.5.1 + (x86_64-pc-linux-gnu) +Date: Mon, 18 Jul 2016 01:44:27 +0200 +Message-ID: <8760s36d9g.fsf@alice.fifthhorseman.net> +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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: Sun, 17 Jul 2016 23:44:37 -0000 + +On Sun 2016-07-17 02:39:53 +0200, David Bremner wrote: +> Daniel Kahn Gillmor writes: +> +>> We want to be able to query the properties directly, like: +>> +>> notmuch count has:foo=bar +>> +>> which should return a count of messages where the property with key +>> "foo" has value equal to "bar". +>> +>> This patch could be improved: +>> +>> If no = sign is present (e.g. "has:foo"), it'd be nice to just match +>> on every message that has property "foo", regardless of value. +> +> At the moment I can't think of a nice easy way to do this. It could do +> something like that proposed for "tag:*", namely expand it internally +> into an or query, by traversing the +> db->allterms_begin("XPROPERTY"). +> +>> It would also be good to include some tests. +> +> and update notmuch-search-terms(7) ? + +yes, please -- patches welcome ;) + +an attempt to describe the distinction between "tags" and "properties": + +Tags are user-settable and user-fetchable, and automated systems are +discouraged from adding them (we have some legacy exceptions like +"inbox" and "unread" and "signed" and "encrypted"). Tags are generally +expected to be simple textual labels. + +Properties are user-fetchable, but should only be set by automated +systems. Properties are key=value pairs (though a given message can +have any number of properties with the same key), and while the key is +expected to be a textual string (printable characters except for "=") +and the value can potentially be arbitrary binary data. + +I welcome edits on this text if it doesn't capture your current sense of +the distinction. + + --dkg -- 2.26.2