aboutsummaryrefslogtreecommitdiff
path: root/lib/database.cc
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2016-03-22 07:54:44 -0300
committerDavid Bremner <david@tethera.net>2016-05-08 08:17:07 -0300
commitbbf6069252d31e6693ee99cce8bf4f9fab47e360 (patch)
treef70aab9b342674e675ac3c5a3794f33b1b05cfae /lib/database.cc
parent1871be319a28d8bba8b368f6b056d2c8448afcf6 (diff)
lib: optionally support single argument date: queries
This relies on the FieldProcessor API, which is only present in xapian >= 1.3.
Diffstat (limited to 'lib/database.cc')
-rw-r--r--lib/database.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/database.cc b/lib/database.cc
index c8c5e261..ebe019fb 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -1000,6 +1000,12 @@ notmuch_database_open_verbose (const char *path,
notmuch->term_gen->set_stemmer (Xapian::Stem ("english"));
notmuch->value_range_processor = new Xapian::NumberValueRangeProcessor (NOTMUCH_VALUE_TIMESTAMP);
notmuch->date_range_processor = new ParseTimeValueRangeProcessor (NOTMUCH_VALUE_TIMESTAMP);
+#if HAVE_XAPIAN_FIELD_PROCESSOR
+ /* This currently relies on the query parser to pass anything
+ * with a .. to the range processor */
+ notmuch->date_field_processor = new DateFieldProcessor();
+ notmuch->query_parser->add_boolean_prefix("date", notmuch->date_field_processor);
+#endif
notmuch->last_mod_range_processor = new Xapian::NumberValueRangeProcessor (NOTMUCH_VALUE_LAST_MOD, "lastmod:");
notmuch->query_parser->set_default_op (Xapian::Query::OP_AND);