From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH] lib: optimize counting documents
Date: Wed, 11 Jan 2017 22:01:15 -0400 [thread overview]
Message-ID: <20170112020115.12503-1-david@tethera.net> (raw)
From #xapian
olly> bremner: btw, i noticed notmuch count see ms to request all the documents and then ignores them
bremner> hmm. There's something funny about the way that notmuch uses matches in general iirc
olly> it should be able to do: mset = enquire.get_mset (0, 0, notmuch->xapian_db->get_doccount ());
...
olly> get_matches_estimated() will be exact because check_at_least is the size of the database
---
lib/query.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/query.cc b/lib/query.cc
index 53efd4e1..4ccd8104 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -606,8 +606,9 @@ _notmuch_query_count_documents (notmuch_query_t *query, const char *type, unsign
/*
* Set the checkatleast parameter to the number of documents
* in the database to make get_matches_estimated() exact.
+ * Set the max parameter to 0 to avoid fetching documents we will discard.
*/
- mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount (),
+ mset = enquire.get_mset (0, 0,
notmuch->xapian_db->get_doccount ());
count = mset.get_matches_estimated();
--
2.11.0
next reply other threads:[~2017-01-12 2:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-12 2:01 David Bremner [this message]
2017-01-18 17:19 ` [PATCH] lib: optimize counting documents Jani Nikula
2017-01-28 2:30 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170112020115.12503-1-david@tethera.net \
--to=david@tethera.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).