From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id C9D196DE0318 for ; Sat, 26 Mar 2016 11:25:25 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.02 X-Spam-Level: X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 tests=[AWL=-0.021, HEADER_FROM_DIFFERENT_DOMAINS=0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VOy9ZL2fMUgJ for ; Sat, 26 Mar 2016 11:25:18 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 364606DE0319 for ; Sat, 26 Mar 2016 11:23:27 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84) (envelope-from ) id 1ajsTM-0000tz-DD for notmuch@notmuchmail.org; Sat, 26 Mar 2016 13:58:04 -0400 Received: (nullmailer pid 8801 invoked by uid 1000); Sat, 26 Mar 2016 17:57:27 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: v2 of libconfig, date:foo, and named query patches Date: Sat, 26 Mar 2016 14:57:10 -0300 Message-Id: <1459015043-8460-1-git-send-email-david@tethera.net> X-Mailer: git-send-email 2.6.4 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Mar 2016 18:25:25 -0000 Sorry for the long series, but there is a lot of moving parts here. This obsoletes id:1458644094-13951-1-git-send-email-david@tethera.net Since that series, the only code changes are a fix for the visibility warning (see the bottom of the interdiff), essentially mimic more 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). Patch 1 could be useful independently of the rest of the series, since allows compiling with xapian 1.3 out of the box. diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst index 98b3c1a..c3470a8 100644 --- a/doc/man1/notmuch-config.rst +++ b/doc/man1/notmuch-config.rst @@ -132,6 +132,12 @@ The available configuration items are described below. Default: ``gpg``. + **options.** + + Compile time option . Current possibilities include + "compact" (see **notmuch-compact(1)**) + and "field_processor" (see **notmuch-search-terms(7)**). + **query.** Expansion for named query called . See diff --git a/doc/man1/notmuch-dump.rst b/doc/man1/notmuch-dump.rst index a37c337..eda9e07 100644 --- a/doc/man1/notmuch-dump.rst +++ b/doc/man1/notmuch-dump.rst @@ -71,6 +71,23 @@ Supported options for **dump** include characters. Note also that tags with spaces will not be correctly restored with this format. + ``--include=(config|tags)`` + + Control what kind of metadata is included in the output. + + **config** + + Output configuration data stored in the database. Each line + starts with "#@ ", followed by a space seperated key-value + pair. Both key and value are hex encoded if needed. + + **tags** + + Output per-message metadata, namely tags. See *format* above + for description of the output. + + The default is to include both tags and configuration information + ``--output=``\ Write output to given file instead of stdout. diff --git a/doc/man1/notmuch-restore.rst b/doc/man1/notmuch-restore.rst index 362e262..87fa22e 100644 --- a/doc/man1/notmuch-restore.rst +++ b/doc/man1/notmuch-restore.rst @@ -50,6 +50,24 @@ Supported options for **restore** include format, this heuristic, based the fact that batch-tag format contains no parentheses, should be accurate. + ``--include=(config|tags)`` + + Control what kind of metadata is restored. + + **config** + + Restore configuration data to the database. Each configuration line starts + with "#@ ", followed by a space seperated key-value pair. + Both key and value are hex encoded if needed. + + **tags** + + Output per-message metadata, namely tags. See *format* above + for more details. + + The default is to restore both tags and configuration + information + ``--input=``\ Read input from given file instead of stdin. diff --git a/doc/man7/notmuch-search-terms.rst b/doc/man7/notmuch-search-terms.rst index 2fbc16d..7474f53 100644 --- a/doc/man7/notmuch-search-terms.rst +++ b/doc/man7/notmuch-search-terms.rst @@ -56,6 +56,8 @@ indicate user-supplied values): - lastmod:.. +- query: + The **from:** prefix is used to match the name or address of the sender of an email message. @@ -132,6 +134,11 @@ were added/removed or filenames changed). This is usually used in conjunction with the **--uuid** argument to **notmuch search** to find messages that have changed since an earlier query. +The **query:** prefix allows queries to refer to previously saved +queries added with **notmuch-config(1)**. Named queries are only +available if notmuch is built with **Xapian Field Processors** (see +below). + Operators --------- @@ -281,9 +288,10 @@ matches from the beginning of January to the end of February. date:..! can be used as a shorthand for date:... The expansion takes place before interpretation, and thus, for example, date:monday..! matches from the beginning of Monday until the end of -Monday. (Note that entering date: without "..", for example -date:yesterday, won't work, as it's not interpreted as a range -expression at all. Again, use date:yesterday..!) +Monday. +With **Xapian Field Processor** support (see below), non-range +date queries such as date:yesterday will work, but otherwise +will give unexpected results; if in doubt use date:yesterday..! Currently, we do not support spaces in range expressions. You can replace the spaces with '\_', or (in most cases) '-', or (in some cases) @@ -370,6 +378,22 @@ Time zones Some time zone codes, e.g. UTC, EET. +XAPIAN FIELD PROCESSORS +======================= + +Certain optional features of the notmuch query processor rely on the +presence of the Xapian field processor API. You can determine if your +notmuch was built against a sufficiently recent version of Xapian by running + +:: + + % notmuch config get options.field_processor + +Currently the following features require field processor support: + +- non-range date queries, e.g. "date:today" +- named queries e.g. "query:my_special_query" + SEE ALSO ======== diff --git a/lib/database-private.h b/lib/database-private.h index f7c6f46..5ab4001 100644 --- a/lib/database-private.h +++ b/lib/database-private.h @@ -148,10 +148,6 @@ operator&=(_notmuch_features &a, _notmuch_features b) Xapian::QueryParser::FLAG_LOVEHATE | Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE | \ Xapian::QueryParser::FLAG_WILDCARD | Xapian::QueryParser::FLAG_PURE_NOT) -#if HAVE_XAPIAN_FIELD_PROCESSOR -class DateFieldProcessor; -class QueryFieldProcessor; -#endif struct _notmuch_database { notmuch_bool_t exception_reported; @@ -185,8 +181,8 @@ struct _notmuch_database { Xapian::ValueRangeProcessor *value_range_processor; Xapian::ValueRangeProcessor *date_range_processor; #if HAVE_XAPIAN_FIELD_PROCESSOR - DateFieldProcessor *date_field_processor; - QueryFieldProcessor *query_field_processor; + Xapian::FieldProcessor *date_field_processor; + Xapian::FieldProcessor *query_field_processor; #endif Xapian::ValueRangeProcessor *last_mod_range_processor; };