unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,
	Notmuch Mail <notmuch@notmuchmail.org>
Subject: Re: [PATCH] add has: query prefix to search for specific properties
Date: Sat, 16 Jul 2016 21:39:53 -0300	[thread overview]
Message-ID: <87ziphxfl2.fsf@zancas.localnet> (raw)
In-Reply-To: <1467969336-7605-1-git-send-email-dkg@fifthhorseman.net>

Daniel Kahn Gillmor <dkg@fifthhorseman.net> 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) ?

>   *	TIMESTAMP:	The time_t value corresponding to the message's
> @@ -260,6 +263,7 @@ static prefix_t BOOLEAN_PREFIX_EXTERNAL[] = {
>      { "is",			"K" },
>      { "id",			"Q" },
>      { "path",			"P" },
> +    { "has",			"XPROPERTY" },
>      /*
>       * Without the ":", since this is a multi-letter prefix, Xapian
>       * will add a colon itself if the first letter of the path is

Do we want to have the same prefix listed in BOOLEAN_PREFIX_INTERNAL and
BOOLEAN_PREFIX_EXTERNAL? this seems quite fragile. If we don't though,
we have to use the same prefix name for queries as in the code (which is
already sprinkled with _find_prefix ("property") ).

  reply	other threads:[~2016-07-17  0:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13  1:05 message properties patches, v1.0 David Bremner
2016-06-13  1:05 ` [PATCH 1/8] lib: read "property" terms from messages David Bremner
2016-06-13  1:05 ` [PATCH 2/8] lib: private string map (associative array) API David Bremner
2016-06-13  8:10   ` Tomi Ollila
2016-06-13 13:02     ` David Bremner
2016-06-13 15:18       ` Bijan Chokoufe Nejad
2016-06-13  1:05 ` [PATCH 3/8] lib: basic message-property API David Bremner
2016-07-08  4:36   ` [PATCH] n_m_remove_property(msg, key, NULL) should removes all properties with key Daniel Kahn Gillmor
2016-07-16 10:32     ` [PATCH] RFC: all deleting all properties with a given key David Bremner
2016-07-17 23:33       ` Daniel Kahn Gillmor
2016-06-13  1:05 ` [PATCH 4/8] lib: extend private string map API with iterators David Bremner
2016-06-13  1:05 ` [PATCH 5/8] lib: iterator API for message properties David Bremner
2016-06-13  1:05 ` [PATCH 6/8] CLI: refactor dumping of tags David Bremner
2016-06-13  1:05 ` [PATCH 7/8] CLI: add properties to dump output David Bremner
2016-06-13  1:05 ` [PATCH 8/8] cli: optionally restore message properties from dump file David Bremner
2016-07-08  9:15   ` [PATCH] add has: query prefix to search for specific properties Daniel Kahn Gillmor
2016-07-17  0:39     ` David Bremner [this message]
2016-07-17 10:38       ` David Bremner
2016-07-17 23:44       ` Daniel Kahn Gillmor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ziphxfl2.fsf@zancas.localnet \
    --to=david@tethera.net \
    --cc=dkg@fifthhorseman.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).