From 0b3de03d9dd225825f6f3e750d81db9b49b72b65 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sun, 24 Jan 2010 13:15:04 +0200 Subject: [PATCH] * mu-query-xapian: support batchsize == 0; use the db->get_doccount in that case --- src/mu-query-xapian.cc | 4 +++- src/mu-query-xapian.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mu-query-xapian.cc b/src/mu-query-xapian.cc index 60a4c145..7c85c670 100644 --- a/src/mu-query-xapian.cc +++ b/src/mu-query-xapian.cc @@ -174,11 +174,13 @@ mu_query_xapian_run (MuQueryXapian *self, const char* searchexpr, { g_return_val_if_fail (self, NULL); g_return_val_if_fail (searchexpr, NULL); - g_return_val_if_fail (batchsize>0, NULL); try { Xapian::Query q(get_query(self, searchexpr)); Xapian::Enquire enq (*self->_db); + + if (batchsize == 0) + batchsize = self->_db->get_doccount(); if (sortfield) enq.set_sort_by_value ( diff --git a/src/mu-query-xapian.h b/src/mu-query-xapian.h index 6be29f3d..38d06431 100644 --- a/src/mu-query-xapian.h +++ b/src/mu-query-xapian.h @@ -71,7 +71,9 @@ char* mu_query_xapian_version (MuQueryXapian *store); * @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 + * 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) * * @return a MuMsgIterXapian instance you can iterate over, or NULL in * case of error