mirror of https://github.com/djcb/mu.git
* mu-msg-iter: support reverse sorting
This commit is contained in:
parent
ef88afc0a7
commit
a936a4dab5
|
@ -52,7 +52,7 @@ private:
|
|||
struct _MuMsgIter {
|
||||
public:
|
||||
_MuMsgIter (Xapian::Enquire &enq, size_t maxnum,
|
||||
gboolean threads, MuMsgFieldId sortfield):
|
||||
gboolean threads, MuMsgFieldId sortfield, bool revert):
|
||||
_enq(enq), _thread_hash (0), _msg(0) {
|
||||
|
||||
_matches = _enq.get_mset (0, maxnum);
|
||||
|
@ -61,7 +61,8 @@ public:
|
|||
|
||||
_matches.fetch();
|
||||
_thread_hash = mu_threader_calculate
|
||||
(this, _matches.size(), sortfield);
|
||||
(this, _matches.size(), sortfield,
|
||||
revert ? TRUE: FALSE);
|
||||
|
||||
ThreadKeyMaker keymaker(_thread_hash);
|
||||
|
||||
|
@ -111,7 +112,7 @@ private:
|
|||
|
||||
MuMsgIter*
|
||||
mu_msg_iter_new (XapianEnquire *enq, size_t maxnum,
|
||||
gboolean threads, MuMsgFieldId sortfield)
|
||||
gboolean threads, MuMsgFieldId sortfield, gboolean revert)
|
||||
{
|
||||
g_return_val_if_fail (enq, NULL);
|
||||
/* sortfield should be set to .._NONE when we're not threading */
|
||||
|
@ -122,7 +123,7 @@ mu_msg_iter_new (XapianEnquire *enq, size_t maxnum,
|
|||
FALSE);
|
||||
try {
|
||||
return new MuMsgIter ((Xapian::Enquire&)*enq, maxnum, threads,
|
||||
sortfield);
|
||||
sortfield, revert ? true : false);
|
||||
|
||||
} MU_XAPIAN_CATCH_BLOCK_RETURN(NULL);
|
||||
}
|
||||
|
|
|
@ -47,13 +47,14 @@ typedef struct _MuMsgIter MuMsgIter;
|
|||
* @param threads whether to calculate threads
|
||||
* @param sorting field when using threads; note, when 'threads' is
|
||||
* FALSE, this should be MU_MSG_FIELD_ID_NONE
|
||||
* @param if TRUE, revert the sorting order
|
||||
*
|
||||
* @return a new MuMsgIter, or NULL in case of error
|
||||
*/
|
||||
MuMsgIter *mu_msg_iter_new (XapianEnquire *enq,
|
||||
size_t batchsize,
|
||||
gboolean threads,
|
||||
MuMsgFieldId threadsortfield) G_GNUC_WARN_UNUSED_RESULT;
|
||||
size_t batchsize, gboolean threads,
|
||||
MuMsgFieldId threadsortfield,
|
||||
gboolean revert) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* get the next message (which you got from
|
||||
|
|
Loading…
Reference in New Issue