Re: [PATCH v4 01/16] add util/search-path.{c, h} to test for executables in $PATH
[notmuch-archives.git] / 3f / bf52185adb6db67f845a45ee1ac7866f9ce02a
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 C9D196DE0318\r
6  for <notmuch@notmuchmail.org>; Sat, 26 Mar 2016 11:25:25 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.02\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 tests=[AWL=-0.021,\r
12   HEADER_FROM_DIFFERENT_DOMAINS=0.001] 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 VOy9ZL2fMUgJ for <notmuch@notmuchmail.org>;\r
16  Sat, 26 Mar 2016 11:25:18 -0700 (PDT)\r
17 Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
18  by arlo.cworth.org (Postfix) with ESMTPS id 364606DE0319\r
19  for <notmuch@notmuchmail.org>; Sat, 26 Mar 2016 11:23:27 -0700 (PDT)\r
20 Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
21  (envelope-from <bremner@tesseract.cs.unb.ca>) id 1ajsTM-0000tz-DD\r
22  for notmuch@notmuchmail.org; Sat, 26 Mar 2016 13:58:04 -0400\r
23 Received: (nullmailer pid 8801 invoked by uid 1000);\r
24  Sat, 26 Mar 2016 17:57:27 -0000\r
25 From: David Bremner <david@tethera.net>\r
26 To: notmuch@notmuchmail.org\r
27 Subject: v2 of libconfig, date:foo, and named query patches\r
28 Date: Sat, 26 Mar 2016 14:57:10 -0300\r
29 Message-Id: <1459015043-8460-1-git-send-email-david@tethera.net>\r
30 X-Mailer: git-send-email 2.6.4\r
31 X-BeenThere: notmuch@notmuchmail.org\r
32 X-Mailman-Version: 2.1.20\r
33 Precedence: list\r
34 List-Id: "Use and development of the notmuch mail system."\r
35  <notmuch.notmuchmail.org>\r
36 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
37  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
38 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
39 List-Post: <mailto:notmuch@notmuchmail.org>\r
40 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
41 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
42  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
43 X-List-Received-Date: Sat, 26 Mar 2016 18:25:25 -0000\r
44 \r
45 Sorry for the long series, but there is a lot of moving parts here.  This obsoletes\r
46 \r
47       id:1458644094-13951-1-git-send-email-david@tethera.net\r
48 \r
49 Since that series, the only code changes are a fix for the visibility\r
50 warning (see the bottom of the interdiff), essentially mimic more\r
51 closely Jani's date time range parser code. There are also a bunch of added docs.  I have no doubt there are improvements that could be made here, but I fixed all of the things I knew about (and I was sure was problems).\r
52 \r
53 Patch 1 could be useful independently of the rest of the series, since\r
54 allows compiling with xapian 1.3 out of the box.\r
55 \r
56 diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst\r
57 index 98b3c1a..c3470a8 100644\r
58 --- a/doc/man1/notmuch-config.rst\r
59 +++ b/doc/man1/notmuch-config.rst\r
60 @@ -132,6 +132,12 @@ The available configuration items are described below.\r
61      \r
62          Default: ``gpg``.\r
63  \r
64 +    **options.<name>**\r
65 +\r
66 +       Compile time option <name>. Current possibilities include\r
67 +       "compact" (see **notmuch-compact(1)**)\r
68 +       and "field_processor" (see **notmuch-search-terms(7)**).\r
69 +\r
70      **query.<name>**\r
71  \r
72          Expansion for named query called <name>. See\r
73 diff --git a/doc/man1/notmuch-dump.rst b/doc/man1/notmuch-dump.rst\r
74 index a37c337..eda9e07 100644\r
75 --- a/doc/man1/notmuch-dump.rst\r
76 +++ b/doc/man1/notmuch-dump.rst\r
77 @@ -71,6 +71,23 @@ Supported options for **dump** include\r
78              characters. Note also that tags with spaces will not be\r
79              correctly restored with this format.\r
80  \r
81 +    ``--include=(config|tags)``\r
82 +\r
83 +    Control what kind of metadata is included in the output.\r
84 +\r
85 +      **config**\r
86 +\r
87 +       Output configuration data stored in the database. Each line\r
88 +       starts with "#@ ", followed by a space seperated key-value\r
89 +       pair.  Both key and value are hex encoded if needed.\r
90 +\r
91 +      **tags**\r
92 +\r
93 +       Output per-message metadata, namely tags. See *format* above\r
94 +       for description of the output.\r
95 +\r
96 +      The default is to include both tags and configuration information\r
97 +\r
98      ``--output=``\ <filename>\r
99          Write output to given file instead of stdout.\r
100  \r
101 diff --git a/doc/man1/notmuch-restore.rst b/doc/man1/notmuch-restore.rst\r
102 index 362e262..87fa22e 100644\r
103 --- a/doc/man1/notmuch-restore.rst\r
104 +++ b/doc/man1/notmuch-restore.rst\r
105 @@ -50,6 +50,24 @@ Supported options for **restore** include\r
106              format, this heuristic, based the fact that batch-tag format\r
107              contains no parentheses, should be accurate.\r
108  \r
109 +    ``--include=(config|tags)``\r
110 +\r
111 +      Control what kind of metadata is restored.\r
112 +\r
113 +       **config**\r
114 +\r
115 +         Restore configuration data to the database. Each configuration line starts\r
116 +         with "#@ ", followed by a space seperated key-value pair.\r
117 +         Both key and value are hex encoded if needed.\r
118 +\r
119 +       **tags**\r
120 +\r
121 +         Output per-message metadata, namely tags. See *format* above\r
122 +         for more details.\r
123 +\r
124 +      The default is to restore both tags and configuration\r
125 +      information\r
126 +\r
127      ``--input=``\ <filename>\r
128          Read input from given file instead of stdin.\r
129  \r
130 diff --git a/doc/man7/notmuch-search-terms.rst b/doc/man7/notmuch-search-terms.rst\r
131 index 2fbc16d..7474f53 100644\r
132 --- a/doc/man7/notmuch-search-terms.rst\r
133 +++ b/doc/man7/notmuch-search-terms.rst\r
134 @@ -56,6 +56,8 @@ indicate user-supplied values):\r
135  \r
136  -  lastmod:<initial-revision>..<final-revision>\r
137  \r
138 +-  query:<name>\r
139 +\r
140  The **from:** prefix is used to match the name or address of the sender\r
141  of an email message.\r
142  \r
143 @@ -132,6 +134,11 @@ were added/removed or filenames changed).  This is usually used in\r
144  conjunction with the **--uuid** argument to **notmuch search**\r
145  to find messages that have changed since an earlier query.\r
146  \r
147 +The **query:** prefix allows queries to refer to previously saved\r
148 +queries added with **notmuch-config(1)**. Named queries are only\r
149 +available if notmuch is built with **Xapian Field Processors** (see\r
150 +below).\r
151 +\r
152  Operators\r
153  ---------\r
154  \r
155 @@ -281,9 +288,10 @@ matches from the beginning of January to the end of February.\r
156  date:<expr>..! can be used as a shorthand for date:<expr>..<expr>. The\r
157  expansion takes place before interpretation, and thus, for example,\r
158  date:monday..! matches from the beginning of Monday until the end of\r
159 -Monday. (Note that entering date:<expr> without "..", for example\r
160 -date:yesterday, won't work, as it's not interpreted as a range\r
161 -expression at all. Again, use date:yesterday..!)\r
162 +Monday.\r
163 +With **Xapian Field Processor** support (see below), non-range\r
164 +date queries such as date:yesterday will work, but otherwise\r
165 +will give unexpected results; if in doubt use date:yesterday..!\r
166  \r
167  Currently, we do not support spaces in range expressions. You can\r
168  replace the spaces with '\_', or (in most cases) '-', or (in some cases)\r
169 @@ -370,6 +378,22 @@ Time zones\r
170  \r
171  Some time zone codes, e.g. UTC, EET.\r
172  \r
173 +XAPIAN FIELD PROCESSORS\r
174 +=======================\r
175 +\r
176 +Certain optional features of the notmuch query processor rely on the\r
177 +presence of the Xapian field processor API. You can determine if your\r
178 +notmuch was built against a sufficiently recent version of Xapian by running\r
179 +\r
180 +::\r
181 +\r
182 +  % notmuch config get options.field_processor\r
183 +\r
184 +Currently the following features require field processor support:\r
185 +\r
186 +- non-range date queries, e.g. "date:today"\r
187 +- named queries e.g. "query:my_special_query"\r
188 +\r
189  SEE ALSO\r
190  ========\r
191  \r
192 diff --git a/lib/database-private.h b/lib/database-private.h\r
193 index f7c6f46..5ab4001 100644\r
194 --- a/lib/database-private.h\r
195 +++ b/lib/database-private.h\r
196 @@ -148,10 +148,6 @@ operator&=(_notmuch_features &a, _notmuch_features b)\r
197                                     Xapian::QueryParser::FLAG_LOVEHATE | Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE | \\r
198                                     Xapian::QueryParser::FLAG_WILDCARD | Xapian::QueryParser::FLAG_PURE_NOT)\r
199  \r
200 -#if HAVE_XAPIAN_FIELD_PROCESSOR\r
201 -class DateFieldProcessor;\r
202 -class QueryFieldProcessor;\r
203 -#endif\r
204  struct _notmuch_database {\r
205      notmuch_bool_t exception_reported;\r
206  \r
207 @@ -185,8 +181,8 @@ struct _notmuch_database {\r
208      Xapian::ValueRangeProcessor *value_range_processor;\r
209      Xapian::ValueRangeProcessor *date_range_processor;\r
210  #if HAVE_XAPIAN_FIELD_PROCESSOR\r
211 -    DateFieldProcessor *date_field_processor;\r
212 -    QueryFieldProcessor *query_field_processor;\r
213 +    Xapian::FieldProcessor *date_field_processor;\r
214 +    Xapian::FieldProcessor *query_field_processor;\r
215  #endif\r
216      Xapian::ValueRangeProcessor *last_mod_range_processor;\r
217  };\r