aboutsummaryrefslogtreecommitdiff
path: root/lib/database.cc
diff options
context:
space:
mode:
authorAustin Clements <amdragon@mit.edu>2014-10-13 02:20:03 -0400
committerDavid Bremner <david@tethera.net>2015-08-14 18:23:49 +0200
commitcb08a2ee019e52dc29ba393d139fce8d7282c632 (patch)
tree77e3d75086d8e257ef3abfdf388e6aa2d3a81ff2 /lib/database.cc
parentf76d8f82dd004cf14426a91e8a80dcd2a4b97317 (diff)
lib: Add "lastmod:" queries for filtering by last modification
The implementation is essentially the same as the date range search prior to Jani's fancy date parser.
Diffstat (limited to 'lib/database.cc')
-rw-r--r--lib/database.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/database.cc b/lib/database.cc
index fc787693..bab33341 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -1000,6 +1000,7 @@ 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);
+ notmuch->last_mod_range_processor = new Xapian::NumberValueRangeProcessor (NOTMUCH_VALUE_LAST_MOD, "lastmod:");
notmuch->query_parser->set_default_op (Xapian::Query::OP_AND);
notmuch->query_parser->set_database (*notmuch->xapian_db);
@@ -1007,6 +1008,7 @@ notmuch_database_open_verbose (const char *path,
notmuch->query_parser->set_stemming_strategy (Xapian::QueryParser::STEM_SOME);
notmuch->query_parser->add_valuerangeprocessor (notmuch->value_range_processor);
notmuch->query_parser->add_valuerangeprocessor (notmuch->date_range_processor);
+ notmuch->query_parser->add_valuerangeprocessor (notmuch->last_mod_range_processor);
for (i = 0; i < ARRAY_SIZE (BOOLEAN_PREFIX_EXTERNAL); i++) {
prefix_t *prefix = &BOOLEAN_PREFIX_EXTERNAL[i];
@@ -1085,6 +1087,8 @@ notmuch_database_close (notmuch_database_t *notmuch)
notmuch->value_range_processor = NULL;
delete notmuch->date_range_processor;
notmuch->date_range_processor = NULL;
+ delete notmuch->last_mod_range_processor;
+ notmuch->last_mod_range_processor = NULL;
return status;
}