aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-08-14 12:02:57 -0300
committerDavid Bremner <david@tethera.net>2022-09-03 08:36:53 -0300
commit606d9b02e46498874f6c3b5af18467c870e8658b (patch)
tree3a873e5c40313c8842ee44dcf5176a120f675ce3 /lib
parent84e4e130e2c920b3dee91901582c4ab6276e2630 (diff)
lib/sexp: provide relative lastmod queries
Test the relatively trivial logic changes for the sexp query parser first before refactoring that logic to share with the infix query parser.
Diffstat (limited to 'lib')
-rw-r--r--lib/parse-sexp.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/parse-sexp.cc b/lib/parse-sexp.cc
index 0f14d8b7..e9ef4268 100644
--- a/lib/parse-sexp.cc
+++ b/lib/parse-sexp.cc
@@ -575,6 +575,9 @@ _sexp_parse_range (notmuch_database_t *notmuch, const _sexp_prefix_t *prefix,
return NOTMUCH_STATUS_BAD_QUERY_SYNTAX;
}
+ if (from_idx < 0)
+ from_idx += notmuch_database_get_revision (notmuch, NULL);
+
try {
if (EMPTY_STRING (to))
to_idx = LONG_MAX;
@@ -585,6 +588,9 @@ _sexp_parse_range (notmuch_database_t *notmuch, const _sexp_prefix_t *prefix,
return NOTMUCH_STATUS_BAD_QUERY_SYNTAX;
}
+ if (to_idx < 0)
+ to_idx += notmuch_database_get_revision (notmuch, NULL);
+
output = Xapian::Query (Xapian::Query::OP_VALUE_RANGE, NOTMUCH_VALUE_LAST_MOD,
Xapian::sortable_serialise (from_idx),
Xapian::sortable_serialise (to_idx));