diff options
| author | David Bremner <david@tethera.net> | 2022-08-14 12:02:59 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2022-09-03 08:43:33 -0300 |
| commit | 2e5ef69fbf9ce9d67720d5d4abba3026302734e5 (patch) | |
| tree | b122d17950f5d228c4616ed819ddeab633867591 /lib/lastmod-fp.cc | |
| parent | 93c602a82fdbd03e0104ea922d073b2b1aa6b241 (diff) | |
lib: add field processor for lastmod: prefix
By sharing the existing logic used by the sexp query parser, this
allows negative lastmod revisions to be interpreted as relative to the
most recent revision.
Diffstat (limited to 'lib/lastmod-fp.cc')
| -rw-r--r-- | lib/lastmod-fp.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/lastmod-fp.cc b/lib/lastmod-fp.cc index 5fdaf281..f85efd28 100644 --- a/lib/lastmod-fp.cc +++ b/lib/lastmod-fp.cc @@ -21,6 +21,7 @@ */ #include "database-private.h" +#include "lastmod-fp.h" notmuch_status_t _notmuch_lastmod_strings_to_query (notmuch_database_t *notmuch, @@ -66,3 +67,17 @@ _notmuch_lastmod_strings_to_query (notmuch_database_t *notmuch, Xapian::sortable_serialise (to_idx)); return NOTMUCH_STATUS_SUCCESS; } + +Xapian::Query +LastModRangeProcessor::operator() (const std::string &begin, const std::string &end) +{ + + Xapian::Query output; + std::string msg; + + if (_notmuch_lastmod_strings_to_query (notmuch, begin, end, output, msg)) + throw Xapian::QueryParserError (msg); + + return output; +} + |
