* remove the needless batching in mu-msg-iter, mu-query, update callers
This commit is contained in:
@ -181,7 +181,8 @@ run_query (MuQuery *xapian, const gchar *query, MuConfig *opts,
|
||||
|
||||
err = NULL;
|
||||
iter = mu_query_run (xapian, query, sortid,
|
||||
opts->descending ? FALSE : TRUE, 0, &err);
|
||||
opts->descending ? FALSE : TRUE,
|
||||
&err);
|
||||
if (!iter) {
|
||||
g_warning ("error: %s", err->message);
|
||||
g_error_free (err);
|
||||
|
||||
@ -335,7 +335,7 @@ mu_query_preprocess (const char *query)
|
||||
MuMsgIter*
|
||||
mu_query_run (MuQuery *self, const char* searchexpr,
|
||||
MuMsgFieldId sortfieldid, gboolean ascending,
|
||||
size_t batchsize, GError **err)
|
||||
GError **err)
|
||||
{
|
||||
g_return_val_if_fail (self, NULL);
|
||||
g_return_val_if_fail (searchexpr, NULL);
|
||||
@ -356,16 +356,14 @@ mu_query_run (MuQuery *self, const char* searchexpr,
|
||||
|
||||
Xapian::Enquire enq (self->_db);
|
||||
|
||||
if (batchsize == 0)
|
||||
batchsize = self->_db.get_doccount();
|
||||
|
||||
if (sortfieldid != MU_MSG_FIELD_ID_NONE)
|
||||
enq.set_sort_by_value ((Xapian::valueno)sortfieldid,
|
||||
ascending ? true : false);
|
||||
enq.set_query(query);
|
||||
enq.set_cutoff(0,0);
|
||||
|
||||
return mu_msg_iter_new ((XapianEnquire*)&enq, batchsize);
|
||||
return mu_msg_iter_new ((XapianEnquire*)&enq,
|
||||
self->_db.get_doccount());
|
||||
|
||||
} MU_XAPIAN_CATCH_BLOCK_RETURN(NULL);
|
||||
}
|
||||
|
||||
@ -73,10 +73,6 @@ char* mu_query_version (MuQuery *store)
|
||||
* sorting is not desired
|
||||
* @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.
|
||||
* If you pass '0' as the batchsize, mu will use the maximum size (the count
|
||||
* of documents in the database)
|
||||
* @param err receives error information (if there is any); if
|
||||
* function returns non-NULL, err will _not_be set. err can be NULL
|
||||
* possible error (err->code) is MU_ERROR_QUERY,
|
||||
@ -86,7 +82,7 @@ char* mu_query_version (MuQuery *store)
|
||||
*/
|
||||
MuMsgIter* mu_query_run (MuQuery *self, const char* expr,
|
||||
MuMsgFieldId sortfieldid, gboolean ascending,
|
||||
size_t batchsize, GError **err)
|
||||
GError **err)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
|
||||
@ -81,7 +81,7 @@ run_and_count_matches (const char *xpath, const char *query)
|
||||
/* } */
|
||||
|
||||
iter = mu_query_run (mquery, query, MU_MSG_FIELD_ID_NONE,
|
||||
FALSE, 1, NULL);
|
||||
FALSE, NULL);
|
||||
mu_query_destroy (mquery);
|
||||
g_assert (iter);
|
||||
|
||||
@ -231,7 +231,7 @@ test_mu_query_accented_chars_01 (void)
|
||||
|
||||
query = mu_query_new (xpath, NULL);
|
||||
iter = mu_query_run (query, "fünkÿ", MU_MSG_FIELD_ID_NONE,
|
||||
FALSE, 1, NULL);
|
||||
FALSE, NULL);
|
||||
err = NULL;
|
||||
msg = mu_msg_iter_get_msg (iter, &err); /* don't unref */
|
||||
if (!msg) {
|
||||
|
||||
@ -335,7 +335,7 @@ run_query (const char *xpath, const char *query, MugMsgListView * self)
|
||||
}
|
||||
|
||||
iter =
|
||||
mu_query_run (xapian, query, MU_MSG_FIELD_ID_DATE, TRUE, 0, &err);
|
||||
mu_query_run (xapian, query, MU_MSG_FIELD_ID_DATE, TRUE, &err);
|
||||
mu_query_destroy (xapian);
|
||||
if (!iter) {
|
||||
g_warning ("Error: %s", err->message);
|
||||
@ -404,6 +404,7 @@ update_model (GtkListStore * store, const char *xpath, const char *query,
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mug_msg_list_view_query (MugMsgListView * self, const char *query)
|
||||
{
|
||||
|
||||
@ -335,7 +335,7 @@ run_query (const char *xpath, const char *query, MugMsgListView * self)
|
||||
}
|
||||
|
||||
iter =
|
||||
mu_query_run (xapian, query, MU_MSG_FIELD_ID_DATE, TRUE, 0, &err);
|
||||
mu_query_run (xapian, query, MU_MSG_FIELD_ID_DATE, TRUE, &err);
|
||||
mu_query_destroy (xapian);
|
||||
if (!iter) {
|
||||
g_warning ("Error: %s", err->message);
|
||||
|
||||
Reference in New Issue
Block a user