[PATCH] fixup! lib: regexp matching in 'subject' and 'from'

David Bremner david at tethera.net
Fri Mar 3 05:23:05 PST 2017


---
 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



More information about the notmuch mailing list