]> git.notmuchmail.org Git - notmuch/blobdiff - lib/parse-sexp.cc
lib/sexp: provide relative lastmod queries
[notmuch] / lib / parse-sexp.cc
index 0f14d8b7307173981ca43f2fbac9d86f91a1b5e1..e9ef4268e5f4d2c951d58b0f3ea3064ed76db2af 100644 (file)
@@ -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));