From 81bd72cebbffcc11be4198a099974a0e0722c86e Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 7 Mar 2017 08:52:39 -0400 Subject: [PATCH 1/3] lib: Fix RegexpPostingSource Remove incorrect skipping to first match from init(), and add explicit skip_to() and check() methods to work around xapian-core bug (the check() method will also improve speed when filtering by one of these). --- lib/regexp-fields.cc | 26 +++++++++++++++++++++----- lib/regexp-fields.h | 2 ++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/regexp-fields.cc b/lib/regexp-fields.cc index b4174750..8e740a81 100644 --- a/lib/regexp-fields.cc +++ b/lib/regexp-fields.cc @@ -62,11 +62,6 @@ 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 (®exp_, (*it_).c_str (), 0, NULL, 0) != 0) { - ++it_; - } } Xapian::doccount @@ -113,6 +108,27 @@ RegexpPostingSource::next (unused (double min_wt)) } } +void +RegexpPostingSource::skip_to (Xapian::docid did, unused (double min_wt)) +{ + started_ = true; + it_.skip_to (did); + for (; ! at_end (); ++it_) { + std::string value = *it_; + if (regexec (®exp_, value.c_str (), 0, NULL, 0) == 0) + break; + } +} + +bool +RegexpPostingSource::check (Xapian::docid did, unused (double min_wt)) +{ + started_ = true; + if (!it_.check (did) || at_end ()) + return false; + return (regexec (®exp_, (*it_).c_str (), 0, NULL, 0) == 0); +} + static inline Xapian::valueno _find_slot (std::string prefix) { if (prefix == "from") diff --git a/lib/regexp-fields.h b/lib/regexp-fields.h index bac11999..a4ba7ad8 100644 --- a/lib/regexp-fields.h +++ b/lib/regexp-fields.h @@ -56,6 +56,8 @@ class RegexpPostingSource : public Xapian::PostingSource Xapian::docid get_docid () const; bool at_end () const; void next (unused (double min_wt)); + void skip_to (Xapian::docid did, unused (double min_wt)); + bool check (Xapian::docid did, unused (double min_wt)); }; From 15f8fc78c87b93f4a1eafa39a4b40bfb98008eb3 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Wed, 8 Mar 2017 08:04:42 -0400 Subject: [PATCH 2/3] version: bump version to 0.24~rc1 --- bindings/python/notmuch/version.py | 2 +- version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/python/notmuch/version.py b/bindings/python/notmuch/version.py index 43071028..7aa101d3 100644 --- a/bindings/python/notmuch/version.py +++ b/bindings/python/notmuch/version.py @@ -1,3 +1,3 @@ # this file should be kept in sync with ../../../version -__VERSION__ = '0.24~rc0' +__VERSION__ = '0.24~rc1' SOVERSION = '4' diff --git a/version b/version index ab10aa0f..1a46dd0a 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.24~rc0 +0.24~rc1 From 29958b2b9a548d0cc6bc2a435e3476cdc6acd7d1 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Wed, 8 Mar 2017 08:10:11 -0400 Subject: [PATCH 3/3] debian: changelog stanza for 0.24~rc1-1 --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3781acf5..b8a0bf9d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +notmuch (0.24~rc1-1) experimental; urgency=medium + + * New upstream release candidate + * upstream release notes + * One library internals fix/optimization for regexp processing. + + -- David Bremner Wed, 08 Mar 2017 08:08:34 -0400 + notmuch (0.24~rc0-1) experimental; urgency=medium * New upstream feature release (candidate).