X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fparse-sexp.cc;fp=lib%2Fparse-sexp.cc;h=e9ef4268e5f4d2c951d58b0f3ea3064ed76db2af;hp=0f14d8b7307173981ca43f2fbac9d86f91a1b5e1;hb=606d9b02e46498874f6c3b5af18467c870e8658b;hpb=84e4e130e2c920b3dee91901582c4ab6276e2630 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));