mirror of https://github.com/djcb/mu.git
* handle the no-matches-found case correctly
This commit is contained in:
parent
06648060da
commit
27a80dcb67
|
@ -71,6 +71,11 @@ public:
|
||||||
_matches = _enq.get_mset (0, G_MAXINT);
|
_matches = _enq.get_mset (0, G_MAXINT);
|
||||||
|
|
||||||
_matches.fetch();
|
_matches.fetch();
|
||||||
|
_cursor = _matches.begin();
|
||||||
|
|
||||||
|
if (_matches.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
_skip_dups = false;
|
_skip_dups = false;
|
||||||
_thread_hash = mu_threader_calculate
|
_thread_hash = mu_threader_calculate
|
||||||
(this, _matches.size(), sortfield, descending);
|
(this, _matches.size(), sortfield, descending);
|
||||||
|
@ -85,6 +90,7 @@ public:
|
||||||
* non-scientific testing suggests. 5-10% or so */
|
* non-scientific testing suggests. 5-10% or so */
|
||||||
if (_matches.size() <= MAX_FETCH_SIZE)
|
if (_matches.size() <= MAX_FETCH_SIZE)
|
||||||
_matches.fetch ();
|
_matches.fetch ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~_MuMsgIter () {
|
~_MuMsgIter () {
|
||||||
|
@ -182,11 +188,10 @@ mu_msg_iter_new (XapianEnquire *enq, size_t maxnum,
|
||||||
sortfield == MU_MSG_FIELD_ID_NONE,
|
sortfield == MU_MSG_FIELD_ID_NONE,
|
||||||
FALSE);
|
FALSE);
|
||||||
try {
|
try {
|
||||||
MuMsgIter *iter;
|
MuMsgIter *iter (new MuMsgIter ((Xapian::Enquire&)*enq,
|
||||||
iter = new MuMsgIter ((Xapian::Enquire&)*enq,
|
maxnum,
|
||||||
maxnum,
|
sortfield,
|
||||||
sortfield,
|
flags));
|
||||||
flags);
|
|
||||||
// note: we check if it's a dup even for the first message,
|
// note: we check if it's a dup even for the first message,
|
||||||
// since we need its uid in the set for checking later messages
|
// since we need its uid in the set for checking later messages
|
||||||
if ((iter->skip_unreadable() && !is_msg_file_readable (iter)) ||
|
if ((iter->skip_unreadable() && !is_msg_file_readable (iter)) ||
|
||||||
|
|
|
@ -71,6 +71,8 @@ mu_threader_calculate (MuMsgIter *iter, size_t matchnum,
|
||||||
|
|
||||||
/* step 1 */
|
/* step 1 */
|
||||||
id_table = create_containers (iter);
|
id_table = create_containers (iter);
|
||||||
|
if (matchnum == 0)
|
||||||
|
return id_table; /* just return an empty table */
|
||||||
|
|
||||||
/* step 2 -- the root_set is the list of children without parent */
|
/* step 2 -- the root_set is the list of children without parent */
|
||||||
root_set = find_root_set (id_table);
|
root_set = find_root_set (id_table);
|
||||||
|
|
Loading…
Reference in New Issue