From c36906a254dcf7298aea2f200074c2996188a6ba Mon Sep 17 00:00:00 2001 From: djcb Date: Sun, 23 Dec 2012 16:42:44 +0200 Subject: [PATCH] * mu-msg-iter.cc: if we're using threaded search results, get *all* matches, calculate threads and then return maxnum matches --- lib/mu-msg-iter.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/mu-msg-iter.cc b/lib/mu-msg-iter.cc index dfc3b1f4..b24c4337 100644 --- a/lib/mu-msg-iter.cc +++ b/lib/mu-msg-iter.cc @@ -53,7 +53,6 @@ private: GHashTable *_threadinfo; }; - struct _MuMsgIter { public: _MuMsgIter (Xapian::Enquire &enq, size_t maxnum, @@ -65,7 +64,11 @@ public: threads = (flags & MU_MSG_ITER_FLAG_THREADS); descending = (flags & MU_MSG_ITER_FLAG_DESCENDING); - _matches = _enq.get_mset (0, maxnum); + /* if we need to calculate threads, initialy get /all/ + * matches, calculate threads based on that, and then + * return maxnum messages + */ + _matches = _enq.get_mset (0, threads ? G_MAXINT: maxnum); /* when threading, we calculate the threads for the * set of matches, then requery/sort based on the @@ -137,7 +140,8 @@ private: MuMsgIterFlags _flags; struct ltstr { - bool operator () (const std::string &s1, const std::string &s2) const { + bool operator () (const std::string &s1, + const std::string &s2) const { return g_strcmp0 (s1.c_str(), s2.c_str()) < 0; } };