]> git.notmuchmail.org Git - notmuch/commitdiff
lib: make notmuch_query_count_messages explicitely exact
authorJani Nikula <jani@nikula.org>
Tue, 14 Oct 2014 16:32:54 +0000 (19:32 +0300)
committerDavid Bremner <david@tethera.net>
Fri, 13 Mar 2015 06:58:55 +0000 (07:58 +0100)
The default is actually exact if no checkatleast parameter is
specified. This change makes that explicit, mainly for documentation,
but also to be safe in the unlikely event of a change of default.

[ commit message rewritten by db based on id:87lho0nlkk.fsf@nikula.org
]

devel/TODO
lib/notmuch.h
lib/query.cc

index 1cf4089f1d93b7a894dc1ada6aba1da12a1fedaf..116194d82ad1b9c4f119b3a91bc283ce9dba544a 100644 (file)
@@ -188,11 +188,6 @@ into the shared-library interface.
 Audit all libnotmuch entry points to ensure that all Xapian calls are
 wrapped in a try/catch block.
 
-Fix the "count" functionality to be exact as Olly explained in IRC:
-
-       ojwb> cworth: if you set the check_at_least parameter to the
-       database size, get_matches_estimated() will be exact
-
 Fix the threading of a message that has a References: header but no
 In-Reply-To: header (see id:"87lixxnxpb.fsf@yoom.home.cworth.org").
 
index f0b60b83a4bd2ec7a54be51426a906fcbc71d168..f0662454c42b439e4d920d223cce9d00707fe253 100644 (file)
@@ -909,10 +909,10 @@ void
 notmuch_threads_destroy (notmuch_threads_t *threads);
 
 /**
- * Return an estimate of the number of messages matching a search.
+ * Return the number of messages matching a search.
  *
- * This function performs a search and returns Xapian's best
- * guess as to number of matching messages.
+ * This function performs a search and returns the number of matching
+ * messages.
  *
  * If a Xapian exception occurs, this function may return 0 (after
  * printing a message).
index 9279915d21ccfbccb9ad9929a4089695a9f55928..57aa6d24844d49ced318f0148f99163bcc932a2a 100644 (file)
@@ -587,7 +587,12 @@ notmuch_query_count_messages (notmuch_query_t *query)
 
        enquire.set_query (final_query);
 
-       mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount ());
+       /*
+        * Set the checkatleast parameter to the number of documents
+        * in the database to make get_matches_estimated() exact.
+        */
+       mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount (),
+                                notmuch->xapian_db->get_doccount ());
 
        count = mset.get_matches_estimated();