1 Return-Path: <mi@kismala.com>
\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 0C857429E25
\r
6 for <notmuch@notmuchmail.org>; Tue, 12 Jul 2011 20:07:20 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 A7fVeCkVinj0 for <notmuch@notmuchmail.org>;
\r
16 Tue, 12 Jul 2011 20:07:18 -0700 (PDT)
\r
17 Received: from imarko.xen.prgmr.com (imarko.xen.prgmr.com [72.13.95.244])
\r
18 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 33072431FB6
\r
21 for <notmuch@notmuchmail.org>; Tue, 12 Jul 2011 20:07:18 -0700 (PDT)
\r
22 Received: from localhost ([127.0.0.1] helo=zsu.kismala.com)
\r
23 by imarko.xen.prgmr.com with esmtp (Exim 4.75)
\r
24 (envelope-from <mi@kismala.com>)
\r
25 id 1QgpnB-0003sw-05; Tue, 12 Jul 2011 20:07:17 -0700
\r
26 From: Istvan Marko <notmuch@kismala.com>
\r
27 To: Austin Clements <amdragon@MIT.EDU>
\r
28 Subject: Re: Slowness (search opens every email file?)
\r
29 References: <20110711190721.GA5386@compy.jasonwoof.org>
\r
30 <CAH-f9WtBHJ8bL6eWoSNrTs=jkrOYYCuWEVVPDUt_iCw0dKcZbw@mail.gmail.com>
\r
31 <20110712202459.GB15019@compy.jasonwoof.org>
\r
32 <CAH-f9WujE8s3DK1PyDGf3kdWLx2qvPx=dp7WZ-z_v8prqauvug@mail.gmail.com>
\r
33 <m3pqlfhrkk.fsf@zsu.kismala.com> <20110713022247.GG25558@mit.edu>
\r
34 Date: Tue, 12 Jul 2011 20:07:16 -0700
\r
35 In-Reply-To: <20110713022247.GG25558@mit.edu> (Austin Clements's message of
\r
36 "Tue, 12 Jul 2011 22:22:47 -0400")
\r
37 Message-ID: <m3liw2j2u3.fsf@zsu.kismala.com>
\r
38 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
\r
40 Content-Type: multipart/mixed; boundary="=-=-="
\r
41 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
42 X-BeenThere: notmuch@notmuchmail.org
\r
43 X-Mailman-Version: 2.1.13
\r
45 List-Id: "Use and development of the notmuch mail system."
\r
46 <notmuch.notmuchmail.org>
\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
50 List-Post: <mailto:notmuch@notmuchmail.org>
\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
54 X-List-Received-Date: Wed, 13 Jul 2011 03:07:20 -0000
\r
57 Content-Type: text/plain
\r
59 Austin Clements <amdragon@MIT.EDU> writes:
\r
61 > I'd say this patch looks good other than coding style
\r
63 > - /* */ comments, starting with a capital letter
\r
64 > - Space between function name and open paren
\r
65 > - Space after comma in argument lists
\r
66 > - Spaces around assignment operator
\r
68 Thanks, fixed the ones I see:
\r
72 Content-Type: text/x-patch
\r
73 Content-Disposition: inline; filename=notmuch-value3.patch
\r
75 diff --git a/lib/database.cc b/lib/database.cc
\r
76 index 9c2f4ec..63a15bb 100644
\r
77 --- a/lib/database.cc
\r
78 +++ b/lib/database.cc
\r
79 @@ -1654,7 +1654,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
\r
82 date = notmuch_message_file_get_header (message_file, "date");
\r
83 - _notmuch_message_set_date (message, date);
\r
84 + _notmuch_message_set_header_values (message, date, from, subject);
\r
86 _notmuch_message_index_file (message, filename);
\r
88 diff --git a/lib/message.cc b/lib/message.cc
\r
89 index d993cde..55070c6 100644
\r
90 --- a/lib/message.cc
\r
91 +++ b/lib/message.cc
\r
92 @@ -410,6 +410,21 @@ _notmuch_message_ensure_message_file (notmuch_message_t *message)
\r
94 notmuch_message_get_header (notmuch_message_t *message, const char *header)
\r
96 + std::string value;
\r
98 + /* Fetch header from the appropriate xapian value field if
\r
100 + if (strcmp(header, "from") == 0)
\r
101 + value = message->doc.get_value(NOTMUCH_VALUE_FROM);
\r
102 + else if (strcmp(header, "subject") == 0)
\r
103 + value = message->doc.get_value (NOTMUCH_VALUE_SUBJECT);
\r
104 + else if (strcmp(header, "message-id") == 0)
\r
105 + value = message->doc.get_value (NOTMUCH_VALUE_MESSAGE_ID);
\r
107 + if (!value.empty())
\r
108 + return talloc_strdup (message, value.c_str ());
\r
110 + /* Otherwise fall back to parsing the file */
\r
111 _notmuch_message_ensure_message_file (message);
\r
112 if (message->message_file == NULL)
\r
114 @@ -785,8 +800,10 @@ notmuch_message_set_author (notmuch_message_t *message,
\r
118 -_notmuch_message_set_date (notmuch_message_t *message,
\r
119 - const char *date)
\r
120 +_notmuch_message_set_header_values (notmuch_message_t *message,
\r
121 + const char *date,
\r
122 + const char *from,
\r
123 + const char *subject)
\r
127 @@ -799,6 +816,8 @@ _notmuch_message_set_date (notmuch_message_t *message,
\r
129 message->doc.add_value (NOTMUCH_VALUE_TIMESTAMP,
\r
130 Xapian::sortable_serialise (time_value));
\r
131 + message->doc.add_value (NOTMUCH_VALUE_FROM, from);
\r
132 + message->doc.add_value (NOTMUCH_VALUE_SUBJECT, subject);
\r
135 /* Synchronize changes made to message->doc out into the database. */
\r
136 diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
\r
137 index 02e24ee..2e91afd 100644
\r
138 --- a/lib/notmuch-private.h
\r
139 +++ b/lib/notmuch-private.h
\r
140 @@ -111,7 +111,9 @@ _internal_error (const char *format, ...) PRINTF_ATTRIBUTE (1, 2);
\r
143 NOTMUCH_VALUE_TIMESTAMP = 0,
\r
144 - NOTMUCH_VALUE_MESSAGE_ID
\r
145 + NOTMUCH_VALUE_MESSAGE_ID,
\r
146 + NOTMUCH_VALUE_FROM,
\r
147 + NOTMUCH_VALUE_SUBJECT
\r
150 /* Xapian (with flint backend) complains if we provide a term longer
\r
151 @@ -287,9 +289,10 @@ void
\r
152 _notmuch_message_ensure_thread_id (notmuch_message_t *message);
\r
155 -_notmuch_message_set_date (notmuch_message_t *message,
\r
156 - const char *date);
\r
158 +_notmuch_message_set_header_values (notmuch_message_t *message,
\r
159 + const char *date,
\r
160 + const char *from,
\r
161 + const char *subject);
\r
163 _notmuch_message_sync (notmuch_message_t *message);
\r
167 Content-Type: text/plain
\r