* add mu_msg_iter_get_index, to get the sequence number of the iterator
This commit is contained in:
@ -41,6 +41,7 @@ enum _MuMsgFieldId {
|
|||||||
MU_MSG_FIELD_ID_TO,
|
MU_MSG_FIELD_ID_TO,
|
||||||
MU_MSG_FIELD_ID_MSGID,
|
MU_MSG_FIELD_ID_MSGID,
|
||||||
MU_MSG_FIELD_ID_TIMESTAMP,
|
MU_MSG_FIELD_ID_TIMESTAMP,
|
||||||
|
|
||||||
MU_MSG_FIELD_ID_NUM,
|
MU_MSG_FIELD_ID_NUM,
|
||||||
|
|
||||||
/* fake fields */
|
/* fake fields */
|
||||||
|
|||||||
@ -31,8 +31,7 @@ struct _MuMsgIter {
|
|||||||
Xapian::Enquire *_enq;
|
Xapian::Enquire *_enq;
|
||||||
Xapian::MSet _matches;
|
Xapian::MSet _matches;
|
||||||
Xapian::MSet::const_iterator _cursor;
|
Xapian::MSet::const_iterator _cursor;
|
||||||
size_t _batchsize;
|
size_t _batchsize, _offset;
|
||||||
size_t _offset;
|
|
||||||
char* _str[MU_MSG_FIELD_ID_NUM];
|
char* _str[MU_MSG_FIELD_ID_NUM];
|
||||||
bool _is_null;
|
bool _is_null;
|
||||||
};
|
};
|
||||||
@ -212,6 +211,16 @@ mu_msg_iter_get_field_numeric (MuMsgIter *iter, MuMsgFieldId mfid)
|
|||||||
} MU_XAPIAN_CATCH_BLOCK_RETURN(static_cast<gint64>(-1));
|
} MU_XAPIAN_CATCH_BLOCK_RETURN(static_cast<gint64>(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
mu_msg_iter_get_index (MuMsgIter *iter)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (iter, (unsigned int)-1);
|
||||||
|
|
||||||
|
return iter->_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* hmmm.... is it impossible to get a 0 docid, or just very improbable? */
|
/* hmmm.... is it impossible to get a 0 docid, or just very improbable? */
|
||||||
unsigned int
|
unsigned int
|
||||||
mu_msg_iter_get_docid (MuMsgIter *iter)
|
mu_msg_iter_get_docid (MuMsgIter *iter)
|
||||||
|
|||||||
@ -87,6 +87,20 @@ MuMsg* mu_msg_iter_get_msg (MuMsgIter *iter, GError **err)
|
|||||||
unsigned int mu_msg_iter_get_docid (MuMsgIter *iter);
|
unsigned int mu_msg_iter_get_docid (MuMsgIter *iter);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the index for this iterator (ie. somewhere between [0..n-1],
|
||||||
|
* with being the number of matches, and increasing 1 for each
|
||||||
|
* iter_next)
|
||||||
|
*
|
||||||
|
* @param iter a valid MuMsgIter
|
||||||
|
*
|
||||||
|
* @return the index or (unsigned int)-1 in case of error
|
||||||
|
|
||||||
|
*/
|
||||||
|
unsigned int mu_msg_iter_get_index (MuMsgIter *iter);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the full path of the message file
|
* get the full path of the message file
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user