1 Return-Path: <jani@nikula.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 2B732431FB6
\r
6 for <notmuch@notmuchmail.org>; Tue, 14 Oct 2014 09:33:08 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id r+QsW40HrO0c for <notmuch@notmuchmail.org>;
\r
16 Tue, 14 Oct 2014 09:33:00 -0700 (PDT)
\r
17 Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com
\r
18 [209.85.212.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 08D56431FAF
\r
21 for <notmuch@notmuchmail.org>; Tue, 14 Oct 2014 09:32:59 -0700 (PDT)
\r
22 Received: by mail-wi0-f171.google.com with SMTP id em10so10638041wid.10
\r
23 for <notmuch@notmuchmail.org>; Tue, 14 Oct 2014 09:32:57 -0700 (PDT)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=1e100.net; s=20130820;
\r
26 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
\r
28 bh=/3OJ8ww6jEGA/3hb+JUd3YiOPju3T0QHJ875msdZhNg=;
\r
29 b=b9LceQH4Vu++6mZhxG6vSED6xwepq0PnF73BA2wWmahVMscoi4rzCpcdNzjQ4cDt8u
\r
30 /4Gp1siEWmK4w3ScjQKZaLXH19kWY6UNrU29rHLpxL9IuyL6592NeOYLpU2rf1LmVAow
\r
31 SjlP6NjQtmhibOdZ+eujxIbejYQXIBiLce2ISwRH4IMO5prOUDoZJ7I/ZCL935YIggro
\r
32 7L2DEbITVOlezeWIMKKdcMqFaN7XX3stBe1Gvu8CX56M7gGDoB79kJreBQGkcRvnWT/9
\r
33 AJdJ1FJga0+JJFUSJYSx00RGSh1aF8O21IYaY/Wj5IN39HGyrB1nuIXeSyWPH9xPSCxX
\r
36 ALoCoQl5DoojswH99guuWWSfTi06E76djL81PNzs1idcg9sm7dY7UjjK/WRPWKXHWh42Iu0N7o5g
\r
37 X-Received: by 10.194.239.164 with SMTP id vt4mr3383229wjc.131.1413304376948;
\r
38 Tue, 14 Oct 2014 09:32:56 -0700 (PDT)
\r
39 Received: from localhost (mobile-internet-5d6ad2-138.dhcp.inet.fi.
\r
41 by mx.google.com with ESMTPSA id ga7sm16287360wic.5.2014.10.14.09.32.55
\r
42 for <multiple recipients>
\r
43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
44 Tue, 14 Oct 2014 09:32:56 -0700 (PDT)
\r
45 From: Jani Nikula <jani@nikula.org>
\r
46 To: Sergei Shilovsky <sshilovsky@gmail.com>,
\r
47 notmuch@notmuchmail.org
\r
48 Subject: [PATCH] lib: make notmuch_query_count_messages exact
\r
49 Date: Tue, 14 Oct 2014 19:32:54 +0300
\r
50 Message-Id: <1413304374-17997-1-git-send-email-jani@nikula.org>
\r
51 X-Mailer: git-send-email 2.1.1
\r
52 In-Reply-To: <1413298112-19912-2-git-send-email-sshilovsky@gmail.com>
\r
53 References: <1413298112-19912-2-git-send-email-sshilovsky@gmail.com>
\r
54 X-BeenThere: notmuch@notmuchmail.org
\r
55 X-Mailman-Version: 2.1.13
\r
57 List-Id: "Use and development of the notmuch mail system."
\r
58 <notmuch.notmuchmail.org>
\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
62 List-Post: <mailto:notmuch@notmuchmail.org>
\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
66 X-List-Received-Date: Tue, 14 Oct 2014 16:33:08 -0000
\r
68 Our tests have expected this to be exact all along, but maybe
\r
69 inaccuracies only show up with big databases.
\r
71 devel/TODO | 5 -----
\r
72 lib/notmuch.h | 6 +++---
\r
73 lib/query.cc | 7 ++++++-
\r
74 3 files changed, 9 insertions(+), 9 deletions(-)
\r
76 diff --git a/devel/TODO b/devel/TODO
\r
77 index 1cf4089f1d93..116194d82ad1 100644
\r
80 @@ -188,11 +188,6 @@ into the shared-library interface.
\r
81 Audit all libnotmuch entry points to ensure that all Xapian calls are
\r
82 wrapped in a try/catch block.
\r
84 -Fix the "count" functionality to be exact as Olly explained in IRC:
\r
86 - ojwb> cworth: if you set the check_at_least parameter to the
\r
87 - database size, get_matches_estimated() will be exact
\r
89 Fix the threading of a message that has a References: header but no
\r
90 In-Reply-To: header (see id:"87lixxnxpb.fsf@yoom.home.cworth.org").
\r
92 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
93 index dae041640fdb..6091082617e7 100644
\r
96 @@ -893,10 +893,10 @@ void
\r
97 notmuch_threads_destroy (notmuch_threads_t *threads);
\r
100 - * Return an estimate of the number of messages matching a search.
\r
101 + * Return the number of messages matching a search.
\r
103 - * This function performs a search and returns Xapian's best
\r
104 - * guess as to number of matching messages.
\r
105 + * This function performs a search and returns the number of matching
\r
108 * If a Xapian exception occurs, this function may return 0 (after
\r
109 * printing a message).
\r
110 diff --git a/lib/query.cc b/lib/query.cc
\r
111 index 60ff8bd9a39e..ce26e3f3e4ed 100644
\r
114 @@ -557,7 +557,12 @@ notmuch_query_count_messages (notmuch_query_t *query)
\r
116 enquire.set_query (final_query);
\r
118 - mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount ());
\r
120 + * Set the checkatleast parameter to the number of documents
\r
121 + * in the database to make get_matches_estimated() exact.
\r
123 + mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount (),
\r
124 + notmuch->xapian_db->get_doccount ());
\r
126 count = mset.get_matches_estimated();
\r