1 Return-Path: <bremner@tesseract.cs.unb.ca>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by arlo.cworth.org (Postfix) with ESMTP id 964C56DE1B7C
\r
6 for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 16:03:33 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.503 tagged_above=-999 required=5 tests=[AWL=0.493,
\r
12 T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id RR2H6y1SffnT for <notmuch@notmuchmail.org>;
\r
16 Sun, 5 Apr 2015 16:03:32 -0700 (PDT)
\r
17 Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net
\r
19 by arlo.cworth.org (Postfix) with ESMTPS id AC7FB6DE1BC7
\r
20 for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 16:03:26 -0700 (PDT)
\r
21 Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim
\r
22 4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
23 id 1YetY1-0002pM-1d; Sun, 05 Apr 2015 23:01:45 +0000
\r
24 Received: (nullmailer pid 2249 invoked by uid 1000); Sun, 05 Apr 2015
\r
26 From: David Bremner <david@tethera.net>
\r
27 To: notmuch@notmuchmail.org
\r
28 Subject: [WIP2 07/12] lib: Add "lastmod:" queries for filtering by last
\r
30 Date: Mon, 6 Apr 2015 07:59:09 +0900
\r
31 Message-Id: <1428274754-1698-8-git-send-email-david@tethera.net>
\r
32 X-Mailer: git-send-email 2.1.4
\r
33 In-Reply-To: <1428274754-1698-1-git-send-email-david@tethera.net>
\r
34 References: <1428274754-1698-1-git-send-email-david@tethera.net>
\r
35 X-BeenThere: notmuch@notmuchmail.org
\r
36 X-Mailman-Version: 2.1.18
\r
38 List-Id: "Use and development of the notmuch mail system."
\r
39 <notmuch.notmuchmail.org>
\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
41 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
43 List-Post: <mailto:notmuch@notmuchmail.org>
\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
47 X-List-Received-Date: Sun, 05 Apr 2015 23:03:33 -0000
\r
49 From: Austin Clements <amdragon@mit.edu>
\r
51 XXX Includes reference to notmuch search --db-revision, which doesn't
\r
54 doc/man7/notmuch-search-terms.rst | 8 ++++++++
\r
55 lib/database-private.h | 1 +
\r
56 lib/database.cc | 4 ++++
\r
57 3 files changed, 13 insertions(+)
\r
59 diff --git a/doc/man7/notmuch-search-terms.rst b/doc/man7/notmuch-search-terms.rst
\r
60 index 1d27ac1..d9f213e 100644
\r
61 --- a/doc/man7/notmuch-search-terms.rst
\r
62 +++ b/doc/man7/notmuch-search-terms.rst
\r
63 @@ -54,6 +54,8 @@ indicate user-supplied values):
\r
65 - date:<since>..<until>
\r
67 +- lastmod:<since>..<until>
\r
69 The **from:** prefix is used to match the name or address of the sender
\r
70 of an email message.
\r
72 @@ -124,6 +126,12 @@ The time range can also be specified using timestamps with a syntax of:
\r
73 Each timestamp is a number representing the number of seconds since
\r
74 1970-01-01 00:00:00 UTC.
\r
76 +The **lastmod:** prefix can be used to restrict the result by the
\r
77 +database revision number of when messages were last modified (tags
\r
78 +were added/removed or filenames changed). This is usually used in
\r
79 +conjunction with the **--db-revision** argument to **notmuch search**
\r
80 +to find messages that have changed since an earlier query.
\r
85 diff --git a/lib/database-private.h b/lib/database-private.h
\r
86 index 4e93257..3fb10f7 100644
\r
87 --- a/lib/database-private.h
\r
88 +++ b/lib/database-private.h
\r
89 @@ -176,6 +176,7 @@ struct _notmuch_database {
\r
90 Xapian::TermGenerator *term_gen;
\r
91 Xapian::ValueRangeProcessor *value_range_processor;
\r
92 Xapian::ValueRangeProcessor *date_range_processor;
\r
93 + Xapian::ValueRangeProcessor *last_mod_range_processor;
\r
96 /* Prior to database version 3, features were implied by the database
\r
97 diff --git a/lib/database.cc b/lib/database.cc
\r
98 index f88bdb3..afa34d6 100644
\r
99 --- a/lib/database.cc
\r
100 +++ b/lib/database.cc
\r
101 @@ -986,6 +986,7 @@ notmuch_database_open_verbose (const char *path,
\r
102 notmuch->term_gen->set_stemmer (Xapian::Stem ("english"));
\r
103 notmuch->value_range_processor = new Xapian::NumberValueRangeProcessor (NOTMUCH_VALUE_TIMESTAMP);
\r
104 notmuch->date_range_processor = new ParseTimeValueRangeProcessor (NOTMUCH_VALUE_TIMESTAMP);
\r
105 + notmuch->last_mod_range_processor = new Xapian::NumberValueRangeProcessor (NOTMUCH_VALUE_LAST_MOD, "lastmod:");
\r
107 notmuch->query_parser->set_default_op (Xapian::Query::OP_AND);
\r
108 notmuch->query_parser->set_database (*notmuch->xapian_db);
\r
109 @@ -993,6 +994,7 @@ notmuch_database_open_verbose (const char *path,
\r
110 notmuch->query_parser->set_stemming_strategy (Xapian::QueryParser::STEM_SOME);
\r
111 notmuch->query_parser->add_valuerangeprocessor (notmuch->value_range_processor);
\r
112 notmuch->query_parser->add_valuerangeprocessor (notmuch->date_range_processor);
\r
113 + notmuch->query_parser->add_valuerangeprocessor (notmuch->last_mod_range_processor);
\r
115 for (i = 0; i < ARRAY_SIZE (BOOLEAN_PREFIX_EXTERNAL); i++) {
\r
116 prefix_t *prefix = &BOOLEAN_PREFIX_EXTERNAL[i];
\r
117 @@ -1071,6 +1073,8 @@ notmuch_database_close (notmuch_database_t *notmuch)
\r
118 notmuch->value_range_processor = NULL;
\r
119 delete notmuch->date_range_processor;
\r
120 notmuch->date_range_processor = NULL;
\r
121 + delete notmuch->last_mod_range_processor;
\r
122 + notmuch->last_mod_range_processor = NULL;
\r