---
 lib/regexp-fields.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/regexp-fields.cc b/lib/regexp-fields.cc
index b2b39504..65108e38 100644
--- a/lib/regexp-fields.cc
+++ b/lib/regexp-fields.cc
@@ -62,6 +62,11 @@ RegexpPostingSource::init (const Xapian::Database &db)
     it_ = db_.valuestream_begin (slot_);
     end_ = db.valuestream_end (slot_);
     started_ = false;
+
+    /* make sure we start on a matching value */
+    while (!at_end() && regexec (&regexp_, (*it_).c_str (), 0, NULL, 0) != 0) {
+       ++it_;
+    }
 }
 
 Xapian::doccount
-- 
2.11.0

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to