1 Return-Path: <schnouki@schnouki.net>
\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 olra.theworths.org (Postfix) with ESMTP id 5CB24429E29
\r
6 for <notmuch@notmuchmail.org>; Tue, 13 Dec 2011 09:12:11 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1]
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id BjaJkPGz3rN4 for <notmuch@notmuchmail.org>;
\r
17 Tue, 13 Dec 2011 09:12:10 -0800 (PST)
\r
18 Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222])
\r
19 by olra.theworths.org (Postfix) with ESMTP id 4F095429E2E
\r
20 for <notmuch@notmuchmail.org>; Tue, 13 Dec 2011 09:12:09 -0800 (PST)
\r
21 Received: from thor.loria.fr (thor.loria.fr [152.81.12.250])
\r
22 by ks3536.kimsufi.com (Postfix) with ESMTPSA id 8B1826A002B;
\r
23 Tue, 13 Dec 2011 18:12:08 +0100 (CET)
\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net;
\r
25 s=key-schnouki; t=1323796328;
\r
26 bh=oEGl7iFrfq2YxyQ9ot7Z/4rGgDdMVu6uuBT4zYsmZD0=;
\r
27 h=From:To:Subject:Date:Message-Id:In-Reply-To:References;
\r
28 b=BnXzyDvLW3U2awNMTCfM3Sml5aubeCadGGqxmo2Zaip8TeH72y6WjCSfWGKb0ZSBc
\r
29 1kQ0Mix5oN09cqVLN7R+iDUDF7+Cj3sJqveXXxr/iQn1kzFaEBKnMNH7hBqvEKOTya
\r
30 bnBUaA/UsR7bs7eV2G7DdqLmsqCz8qwzLYyI96kg=
\r
31 From: Thomas Jost <schnouki@schnouki.net>
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [PATCH 3/5] lib: Make MTIME values searchable
\r
34 Date: Tue, 13 Dec 2011 18:11:43 +0100
\r
35 Message-Id: <1323796305-28789-4-git-send-email-schnouki@schnouki.net>
\r
36 X-Mailer: git-send-email 1.7.8
\r
37 In-Reply-To: <1323796305-28789-1-git-send-email-schnouki@schnouki.net>
\r
38 References: <1323796305-28789-1-git-send-email-schnouki@schnouki.net>
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Tue, 13 Dec 2011 17:12:11 -0000
\r
53 Tag modification times are now searchable as ranges (just like regular message
\r
54 dates) with the "mtime:" prefix.
\r
56 lib/database-private.h | 1 +
\r
57 lib/database.cc | 3 +++
\r
58 notmuch.1 | 14 ++++++++++++--
\r
59 notmuch.c | 13 ++++++++++---
\r
60 4 files changed, 26 insertions(+), 5 deletions(-)
\r
62 diff --git a/lib/database-private.h b/lib/database-private.h
\r
63 index 88532d5..e71c8e4 100644
\r
64 --- a/lib/database-private.h
\r
65 +++ b/lib/database-private.h
\r
66 @@ -52,6 +52,7 @@ struct _notmuch_database {
\r
67 Xapian::QueryParser *query_parser;
\r
68 Xapian::TermGenerator *term_gen;
\r
69 Xapian::ValueRangeProcessor *value_range_processor;
\r
70 + Xapian::ValueRangeProcessor *mtime_value_range_processor;
\r
73 /* Return the list of terms from the given iterator matching a prefix.
\r
74 diff --git a/lib/database.cc b/lib/database.cc
\r
75 index 6dc6f73..cc970c1 100644
\r
76 --- a/lib/database.cc
\r
77 +++ b/lib/database.cc
\r
78 @@ -677,12 +677,14 @@ notmuch_database_open (const char *path,
\r
79 notmuch->term_gen = new Xapian::TermGenerator;
\r
80 notmuch->term_gen->set_stemmer (Xapian::Stem ("english"));
\r
81 notmuch->value_range_processor = new Xapian::NumberValueRangeProcessor (NOTMUCH_VALUE_TIMESTAMP);
\r
82 + notmuch->mtime_value_range_processor = new Xapian::NumberValueRangeProcessor (NOTMUCH_VALUE_MTIME, "mtime:");
\r
84 notmuch->query_parser->set_default_op (Xapian::Query::OP_AND);
\r
85 notmuch->query_parser->set_database (*notmuch->xapian_db);
\r
86 notmuch->query_parser->set_stemmer (Xapian::Stem ("english"));
\r
87 notmuch->query_parser->set_stemming_strategy (Xapian::QueryParser::STEM_SOME);
\r
88 notmuch->query_parser->add_valuerangeprocessor (notmuch->value_range_processor);
\r
89 + notmuch->query_parser->add_valuerangeprocessor (notmuch->mtime_value_range_processor);
\r
91 for (i = 0; i < ARRAY_SIZE (BOOLEAN_PREFIX_EXTERNAL); i++) {
\r
92 prefix_t *prefix = &BOOLEAN_PREFIX_EXTERNAL[i];
\r
93 @@ -726,6 +728,7 @@ notmuch_database_close (notmuch_database_t *notmuch)
\r
94 delete notmuch->query_parser;
\r
95 delete notmuch->xapian_db;
\r
96 delete notmuch->value_range_processor;
\r
97 + delete notmuch->mtime_value_range_processor;
\r
98 talloc_free (notmuch);
\r
101 diff --git a/notmuch.1 b/notmuch.1
\r
102 index 3dbd67e..2235096 100644
\r
105 @@ -644,6 +644,8 @@ terms to match against specific portions of an email, (where
\r
107 folder:<directory-path>
\r
109 + mtime:<timestamp-range>
\r
113 prefix is used to match the name or address of the sender of an email
\r
114 @@ -707,8 +709,8 @@ operators, but will have to be protected from interpretation by the
\r
115 shell, (such as by putting quotation marks around any parenthesized
\r
118 -Finally, results can be restricted to only messages within a
\r
119 -particular time range, (based on the Date: header) with a syntax of:
\r
120 +Results can be restricted to only messages within a particular time range,
\r
121 +(based on the Date: header) with a syntax of:
\r
123 <initial-timestamp>..<final-timestamp>
\r
125 @@ -721,6 +723,14 @@ specify a date range to return messages from 2009\-10\-01 until the
\r
128 $(date +%s \-d 2009\-10\-01)..$(date +%s)
\r
132 +prefix can be used to search for messages which were modified (e.g. tags were
\r
133 +added or removed) within a particular time range, with the same syntax as
\r
136 + mtime:<initial-timestamp>..<final-timestamp>
\r
138 Hooks are scripts (or arbitrary executables or symlinks to such) that notmuch
\r
139 invokes before and after certain actions. These scripts reside in
\r
140 diff --git a/notmuch.c b/notmuch.c
\r
141 index c0ce026..443cf59 100644
\r
144 @@ -71,6 +71,7 @@ static const char search_terms_help[] =
\r
145 "\t\tid:<message-id>\n"
\r
146 "\t\tthread:<thread-id>\n"
\r
147 "\t\tfolder:<directory-path>\n"
\r
148 + "\t\tmtime:<timestamp-range>\n"
\r
150 "\tThe from: prefix is used to match the name or address of\n"
\r
151 "\tthe sender of an email message.\n"
\r
152 @@ -112,8 +113,8 @@ static const char search_terms_help[] =
\r
153 "\tinterpretation by the shell, (such as by putting quotation\n"
\r
154 "\tmarks around any parenthesized expression).\n"
\r
156 - "\tFinally, results can be restricted to only messages within a\n"
\r
157 - "\tparticular time range, (based on the Date: header) with:\n"
\r
158 + "\tResults can be restricted to only messages within a particular\n"
\r
159 + "\ttime range, (based on the Date: header) with:\n"
\r
161 "\t\t<intial-timestamp>..<final-timestamp>\n"
\r
163 @@ -125,7 +126,13 @@ static const char search_terms_help[] =
\r
164 "\tfollowing syntax would specify a date range to return messages\n"
\r
165 "\tfrom 2009-10-01 until the current time:\n"
\r
167 - "\t\t$(date +%%s -d 2009-10-01)..$(date +%%s)\n\n";
\r
168 + "\t\t$(date +%%s -d 2009-10-01)..$(date +%%s)\n\n"
\r
170 + "\tFinally, the mtime: prefix can be used to search for messages\n"
\r
171 + "\twhich were modified (e.g. tags were added or removed) within a\n"
\r
172 + "\tparticular time range, with the same syntax as before:\n"
\r
174 + "\t\tmtime:<initial-timestamp>..<final-timestamp>\n";
\r
176 static const char hooks_help[] =
\r
177 "\tHooks are scripts (or arbitrary executables or symlinks to such) that\n"
\r