unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* help wanted: "notmuch count property:foo" as distinct from "notmuch count property:foo=bar"
@ 2017-01-17 20:31 Daniel Kahn Gillmor
  0 siblings, 0 replies; only message in thread
From: Daniel Kahn Gillmor @ 2017-01-17 20:31 UTC (permalink / raw)
  To: Notmuch Mail

[-- Attachment #1: Type: text/plain, Size: 2276 bytes --]

in lib/database.cc, we have this FIXME in a comment:

 * Mail document
 * -------------
 * A mail document is associated with a particular email message. It
 * is stored in one or more files on disk (though only one has its
 * content indexed) and is uniquely identified  by its "id" field
 * (which is generally the message ID). It is indexed with the
 * following prefixed terms which the database uses to construct
 * threads, etc.:
   […]
 *    Multiple terms of given prefix:
 *
   […]
 *      property:       Has a property with key=value
 *                 FIXME: if no = is present, should match on any value


If we had it resolved, other improvments i'd like to make to notmuch
would be significantly easier to test!

I've been looking at trying to fix this FIXME by analogy with either our
special nifty date: handler, or by analogy with the re: handlers
introduced in id:20161114214651.19770-1-david@tethera.net, but my
xapian-fu doesn't appear to be up to the task at the moment.

The date: handler appears to rely on some xapian magic to be able to
handle both date:$DAY and date:$FIRSTDAY..$SECONDDAY (that is, deciding
how to query based on the presence or absence of "..", as we'd want to
do with "=" in the property: query)

And the re: handlers allow different styles of searching a field, but
they use a distinct prefix for their queries (it would be good to just
keep it to "property:" in both cases).

So, to be clear, searching for:

  * property:foo would give a hit on any message that had property "foo"
    set to anything.

  * property:foo=bar would tive a hit on any message that had property
    "foo" set to *exactly* "bar".

  * in particular, property:foo= would give a hit on anything that had
    property "foo" set to the empty string.

Bremner was very helpful on #notmuch, pointed me to the above message,
and suggested the basic outlines of a fix but his help still wasn't
enough for me to figure out the right way to clear this FIXME.

I'd welcome more help in resolving this.  For someone who understands
Xapian's query parser and how notmuch is using it, i'm imagining this
wouldn't be a lot of work.  I'm happy to test and review any patches.

hopefully,

         --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-18  3:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-17 20:31 help wanted: "notmuch count property:foo" as distinct from "notmuch count property:foo=bar" Daniel Kahn Gillmor

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).