* mu-query-xapian.{cc,h}: add batch param, add documentation, cosmetics
This commit is contained in:
@ -169,13 +169,14 @@ mu_query_xapian_destroy (MuQueryXapian *self)
|
|||||||
|
|
||||||
MuMsgIterXapian*
|
MuMsgIterXapian*
|
||||||
mu_query_xapian_run (MuQueryXapian *self, const char* searchexpr,
|
mu_query_xapian_run (MuQueryXapian *self, const char* searchexpr,
|
||||||
const MuMsgField* sortfield, gboolean ascending)
|
const MuMsgField* sortfield, gboolean ascending,
|
||||||
|
size_t batchsize)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (self, NULL);
|
g_return_val_if_fail (self, NULL);
|
||||||
g_return_val_if_fail (searchexpr, NULL);
|
g_return_val_if_fail (searchexpr, NULL);
|
||||||
|
g_return_val_if_fail (batchsize>0, NULL);
|
||||||
try {
|
|
||||||
|
|
||||||
|
try {
|
||||||
Xapian::Query q(get_query(self, searchexpr));
|
Xapian::Query q(get_query(self, searchexpr));
|
||||||
Xapian::Enquire enq (*self->_db);
|
Xapian::Enquire enq (*self->_db);
|
||||||
|
|
||||||
@ -184,10 +185,10 @@ mu_query_xapian_run (MuQueryXapian *self, const char* searchexpr,
|
|||||||
(Xapian::valueno)mu_msg_field_id(sortfield),
|
(Xapian::valueno)mu_msg_field_id(sortfield),
|
||||||
ascending);
|
ascending);
|
||||||
|
|
||||||
enq.set_query (q);
|
enq.set_query(q);
|
||||||
enq.set_cutoff (0,0);
|
enq.set_cutoff(0,0);
|
||||||
|
|
||||||
return mu_msg_iter_xapian_new (enq, 10000); /* FIXME */
|
return mu_msg_iter_xapian_new (enq, batchsize);
|
||||||
|
|
||||||
} MU_XAPIAN_CATCH_BLOCK_RETURN(NULL);
|
} MU_XAPIAN_CATCH_BLOCK_RETURN(NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,6 +67,11 @@ char* mu_query_xapian_version (MuQueryXapian *store);
|
|||||||
*
|
*
|
||||||
* @param self a valid MuQueryXapian instance
|
* @param self a valid MuQueryXapian instance
|
||||||
* @param expr the search expression
|
* @param expr the search expression
|
||||||
|
* @param sortfield the field to sort by
|
||||||
|
* @param ascending if TRUE sort in ascending (A-Z) order, otherwise,
|
||||||
|
* sort in descending (Z-A) order
|
||||||
|
* @param batchsize the size of batches to receive; this is mainly for
|
||||||
|
* reasons - it's best to get the size one wants to show the user at once
|
||||||
*
|
*
|
||||||
* @return a MuMsgIterXapian instance you can iterate over, or NULL in
|
* @return a MuMsgIterXapian instance you can iterate over, or NULL in
|
||||||
* case of error
|
* case of error
|
||||||
@ -74,7 +79,8 @@ char* mu_query_xapian_version (MuQueryXapian *store);
|
|||||||
MuMsgIterXapian* mu_query_xapian_run (MuQueryXapian *self,
|
MuMsgIterXapian* mu_query_xapian_run (MuQueryXapian *self,
|
||||||
const char* expr,
|
const char* expr,
|
||||||
const MuMsgField* sortfield,
|
const MuMsgField* sortfield,
|
||||||
gboolean ascending)
|
gboolean ascending,
|
||||||
|
size_t batchsize)
|
||||||
G_GNUC_WARN_UNUSED_RESULT;
|
G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,7 +95,8 @@ G_GNUC_WARN_UNUSED_RESULT;
|
|||||||
* case of error; free with g_free when it's no longer needed
|
* case of error; free with g_free when it's no longer needed
|
||||||
*/
|
*/
|
||||||
char* mu_query_xapian_combine (const gchar **params,
|
char* mu_query_xapian_combine (const gchar **params,
|
||||||
gboolean connect_or) G_GNUC_WARN_UNUSED_RESULT;
|
gboolean connect_or)
|
||||||
|
G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get a string representation of the Xapian search query
|
* get a string representation of the Xapian search query
|
||||||
@ -101,7 +108,8 @@ char* mu_query_xapian_combine (const gchar **params,
|
|||||||
* error; free the returned value with g_free
|
* error; free the returned value with g_free
|
||||||
*/
|
*/
|
||||||
char* mu_query_xapian_as_string (MuQueryXapian *self,
|
char* mu_query_xapian_as_string (MuQueryXapian *self,
|
||||||
const char* searchexpr) G_GNUC_WARN_UNUSED_RESULT;
|
const char* searchexpr)
|
||||||
|
G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
Reference in New Issue
Block a user