[PATCH v2 02/11] lib: database: store message filesize & add range processor

David Bremner david at tethera.net
Fri Jun 9 16:18:07 PDT 2017

Ioan-Adrian Ratiu <adi at adirat.com> writes:

> The filesize and range processor are very useful to do search queries
> like "filesize:1000..10000". All sizes are in bytes for now because
> that's what I'm interested in.

Some points to mention in the commit message

- you're adding a term prefix (although as discussed in the previous
  message, and below, I don't think you want to be)

- you're extending the query language.

- it's fine that all sizes are in bytes, but the main point is not your
  motivation but that it can be extended to other units in the future by
  preprocessing the query.
> I think the database needs to be re-created for this to work so that
> all newly indexed messages have the new xapian filesize value, I did
> not have the time to test a "hybrid" database where just some of the
> messages have the value.

see commit 0de999aab5bd4cd44bc4ea76fd1d25172bd839ae for how to handle

After this commit, you have enough new features to test indexing and
searching by file size, so please do, in particular testing the case you
mention above. The new syntax should work with e.g. "notmuch search" and
"notmuch show".

> +    { "filesize",		"XFILESIZE",	NOTMUCH_FIELD_EXTERNAL },
>  };

This is a bit subtle, but I don't think you should add filesize to this
table (compare with "lastmod").

More information about the notmuch mailing list