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 1BB04431FB6
\r
6 for <notmuch@notmuchmail.org>; Tue, 28 Oct 2014 10:36:25 -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 az0uozS+Ssur for <notmuch@notmuchmail.org>;
\r
16 Tue, 28 Oct 2014 10:36:17 -0700 (PDT)
\r
17 Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com
\r
18 [74.125.82.44]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 422CE431FBC for <notmuch@notmuchmail.org>; Tue, 28 Oct 2014 10:36:17 -0700
\r
22 Received: by mail-wg0-f44.google.com with SMTP id y10so19954wgg.31
\r
23 for <notmuch@notmuchmail.org>; Tue, 28 Oct 2014 10:36:16 -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:subject:in-reply-to:references
\r
27 :user-agent:date:message-id:mime-version:content-type;
\r
28 bh=qfq7qQvWejqq1t3l6g5khj8MfYtpFTuXfTF349GV+5o=;
\r
29 b=Q5Qghj3h7laJlto4elLkFSQfg8HgT/b3tgcEJJ3P5d+kJ5FYk2cUXZ2Xi8KhLMsoxC
\r
30 JOu5DQ9BUC7LpdH5TzWEs/Vu+R6P8fJCjn89J/Z2rOrOcHuZwhFz9H2m4aqOtWuupDMR
\r
31 TKixcapa1PYgvIkqdTQPslfMgya2m2FJ4Lg3jJ5GEXU2Mfx7i5v1AyhkKtazM2rnLEbB
\r
32 kgB7KNzGaUsVC1fX27QxggV5aJAY3BlylxmIasMUNwHIRYiYcAZRax6/EXKU//n7eNmM
\r
33 t/scMCaj/OSjOmfV2yUBfBHIjI8qsRc/gahJqihcdLWBBa3TV25i6zb2U0MZFl682odk
\r
36 ALoCoQnL/OZLrw1EZRWaxclhJjboUSdrdWytpLJb/Hfq0kG7k2rxq9pNBCKKk+amaOfygflm2QOK
\r
37 X-Received: by 10.194.185.167 with SMTP id fd7mr6306758wjc.108.1414517774439;
\r
38 Tue, 28 Oct 2014 10:36:14 -0700 (PDT)
\r
39 Received: from localhost (dsl-hkibrasgw2-58c36d-48.dhcp.inet.fi.
\r
41 by mx.google.com with ESMTPSA id eu8sm11205161wic.1.2014.10.28.10.36.13
\r
42 for <multiple recipients>
\r
43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
44 Tue, 28 Oct 2014 10:36:13 -0700 (PDT)
\r
45 From: Jani Nikula <jani@nikula.org>
\r
46 To: Sergei Shilovsky <sshilovsky@gmail.com>, notmuch@notmuchmail.org
\r
47 Subject: Re: [PATCH] lib: make notmuch_query_count_messages exact
\r
48 In-Reply-To: <1413304374-17997-1-git-send-email-jani@nikula.org>
\r
49 References: <1413298112-19912-2-git-send-email-sshilovsky@gmail.com>
\r
50 <1413304374-17997-1-git-send-email-jani@nikula.org>
\r
51 User-Agent: Notmuch/0.18.2+148~g0318cd3 (http://notmuchmail.org) Emacs/24.3.1
\r
52 (x86_64-pc-linux-gnu)
\r
53 Date: Tue, 28 Oct 2014 19:36:11 +0200
\r
54 Message-ID: <87lho0nlkk.fsf@nikula.org>
\r
56 Content-Type: text/plain
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Tue, 28 Oct 2014 17:36:25 -0000
\r
71 On Tue, 14 Oct 2014, Jani Nikula <jani@nikula.org> wrote:
\r
72 > Our tests have expected this to be exact all along, but maybe
\r
73 > inaccuracies only show up with big databases.
\r
75 >From my IRC logs on Thu Oct 16 2014
\r
77 j4ni olly: does this do what it claims?
\r
78 http://mid.gmane.org/1413304374-17997-1-git-send-email-jani@nikula.org
\r
79 olly j4ni: not really
\r
80 olly if you don't set check at least it defaults to the number of
\r
82 olly so the code part is effectively a no-op
\r
83 olly but the reported number will be exact already so the comment
\r
85 olly i guess you could argue there's some merit in passing it explicitly
\r
86 in case someone decreases the request number of results
\r
89 > devel/TODO | 5 -----
\r
90 > lib/notmuch.h | 6 +++---
\r
91 > lib/query.cc | 7 ++++++-
\r
92 > 3 files changed, 9 insertions(+), 9 deletions(-)
\r
94 > diff --git a/devel/TODO b/devel/TODO
\r
95 > index 1cf4089f1d93..116194d82ad1 100644
\r
98 > @@ -188,11 +188,6 @@ into the shared-library interface.
\r
99 > Audit all libnotmuch entry points to ensure that all Xapian calls are
\r
100 > wrapped in a try/catch block.
\r
102 > -Fix the "count" functionality to be exact as Olly explained in IRC:
\r
104 > - ojwb> cworth: if you set the check_at_least parameter to the
\r
105 > - database size, get_matches_estimated() will be exact
\r
107 > Fix the threading of a message that has a References: header but no
\r
108 > In-Reply-To: header (see id:"87lixxnxpb.fsf@yoom.home.cworth.org").
\r
110 > diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
111 > index dae041640fdb..6091082617e7 100644
\r
112 > --- a/lib/notmuch.h
\r
113 > +++ b/lib/notmuch.h
\r
114 > @@ -893,10 +893,10 @@ void
\r
115 > notmuch_threads_destroy (notmuch_threads_t *threads);
\r
118 > - * Return an estimate of the number of messages matching a search.
\r
119 > + * Return the number of messages matching a search.
\r
121 > - * This function performs a search and returns Xapian's best
\r
122 > - * guess as to number of matching messages.
\r
123 > + * This function performs a search and returns the number of matching
\r
126 > * If a Xapian exception occurs, this function may return 0 (after
\r
127 > * printing a message).
\r
128 > diff --git a/lib/query.cc b/lib/query.cc
\r
129 > index 60ff8bd9a39e..ce26e3f3e4ed 100644
\r
130 > --- a/lib/query.cc
\r
131 > +++ b/lib/query.cc
\r
132 > @@ -557,7 +557,12 @@ notmuch_query_count_messages (notmuch_query_t *query)
\r
134 > enquire.set_query (final_query);
\r
136 > - mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount ());
\r
138 > + * Set the checkatleast parameter to the number of documents
\r
139 > + * in the database to make get_matches_estimated() exact.
\r
141 > + mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount (),
\r
142 > + notmuch->xapian_db->get_doccount ());
\r
144 > count = mset.get_matches_estimated();
\r