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

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

Date: Fri, 3 Mar 2017 09:23:05 -0400

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: David Bremner


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


Thread: