---
I haven't looked carefully at how much work it would be to add to the
infix parser yet. I suspect it means adding a new RangeProcessor class
modelled on ParseTimeRangeProcessor. Maybe some of the logic from
_parse_sexp_range could be shared with the other parser.
lib/parse-sexp.cc | 6 ++++++
test/T570-revision-tracking.sh | 8 ++++++++
2 files changed, 14 insertions(+)
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));
diff --git a/test/T570-revision-tracking.sh b/test/T570-revision-tracking.sh
index e1cc684d..aaa45468 100755
--- a/test/T570-revision-tracking.sh
+++ b/test/T570-revision-tracking.sh
@@ -95,4 +95,12 @@ subtotal=$(notmuch count lastmod:..$lastmod)
result=$(($subtotal == $total-1))
test_expect_equal 1 "$result"
+if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
+ test_begin_subtest 'exclude one message using negative lastmod (sexp)'
+ total=$(notmuch count '*')
+ notmuch tag +${RANDOM} id:4EFC743A.3060609@april.org
+ count=$(notmuch count --query=sexp '(lastmod -1 *)')
+ test_expect_equal 1 "$count"
+fi
+
test_done
--
2.35.2
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org