1 Return-Path: <bremner@tesseract.cs.unb.ca>
\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 arlo.cworth.org (Postfix) with ESMTP id 47AC26DE02D9
\r
6 for <notmuch@notmuchmail.org>; Sat, 26 Mar 2016 11:24:37 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 tests=[AWL=-0.021,
\r
12 HEADER_FROM_DIFFERENT_DOMAINS=0.001] autolearn=disabled
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id lbk4zdSXNs8Z for <notmuch@notmuchmail.org>;
\r
16 Sat, 26 Mar 2016 11:24:29 -0700 (PDT)
\r
17 Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])
\r
18 by arlo.cworth.org (Postfix) with ESMTPS id 48C016DE02A9
\r
19 for <notmuch@notmuchmail.org>; Sat, 26 Mar 2016 11:23:25 -0700 (PDT)
\r
20 Received: from remotemail by fethera.tethera.net with local (Exim 4.84)
\r
21 (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
22 id 1ajsTX-0000vP-8b; Sat, 26 Mar 2016 13:58:15 -0400
\r
23 Received: (nullmailer pid 8826 invoked by uid 1000);
\r
24 Sat, 26 Mar 2016 17:57:27 -0000
\r
25 From: David Bremner <david@tethera.net>
\r
26 To: notmuch@notmuchmail.org
\r
27 Subject: [Patch v2 12/13] lib: make a global constant for query parser flags
\r
28 Date: Sat, 26 Mar 2016 14:57:22 -0300
\r
29 Message-Id: <1459015043-8460-13-git-send-email-david@tethera.net>
\r
30 X-Mailer: git-send-email 2.6.4
\r
31 In-Reply-To: <1459015043-8460-1-git-send-email-david@tethera.net>
\r
32 References: <1459015043-8460-1-git-send-email-david@tethera.net>
\r
33 X-BeenThere: notmuch@notmuchmail.org
\r
34 X-Mailman-Version: 2.1.20
\r
36 List-Id: "Use and development of the notmuch mail system."
\r
37 <notmuch.notmuchmail.org>
\r
38 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
39 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
41 List-Post: <mailto:notmuch@notmuchmail.org>
\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
43 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
45 X-List-Received-Date: Sat, 26 Mar 2016 18:24:37 -0000
\r
47 It's already kindof gross that this is hardcoded in two different
\r
48 places. We will also need these later in field processors calling back
\r
49 into the query parser.
\r
51 lib/database-private.h | 4 ++++
\r
52 lib/query.cc | 16 ++--------------
\r
53 2 files changed, 6 insertions(+), 14 deletions(-)
\r
55 diff --git a/lib/database-private.h b/lib/database-private.h
\r
56 index e1962f4..b5c1f90 100644
\r
57 --- a/lib/database-private.h
\r
58 +++ b/lib/database-private.h
\r
59 @@ -144,6 +144,10 @@ operator&=(_notmuch_features &a, _notmuch_features b)
\r
63 +#define NOTMUCH_QUERY_PARSER_FLAGS (Xapian::QueryParser::FLAG_BOOLEAN | Xapian::QueryParser::FLAG_PHRASE | \
\r
64 + Xapian::QueryParser::FLAG_LOVEHATE | Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE | \
\r
65 + Xapian::QueryParser::FLAG_WILDCARD | Xapian::QueryParser::FLAG_PURE_NOT)
\r
67 struct _notmuch_database {
\r
68 notmuch_bool_t exception_reported;
\r
70 diff --git a/lib/query.cc b/lib/query.cc
\r
71 index e627bfc..972a389 100644
\r
74 @@ -212,12 +212,6 @@ notmuch_query_search_messages_st (notmuch_query_t *query,
\r
75 Xapian::Query string_query, final_query, exclude_query;
\r
77 Xapian::MSetIterator iterator;
\r
78 - unsigned int flags = (Xapian::QueryParser::FLAG_BOOLEAN |
\r
79 - Xapian::QueryParser::FLAG_PHRASE |
\r
80 - Xapian::QueryParser::FLAG_LOVEHATE |
\r
81 - Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
\r
82 - Xapian::QueryParser::FLAG_WILDCARD |
\r
83 - Xapian::QueryParser::FLAG_PURE_NOT);
\r
85 if (strcmp (query_string, "") == 0 ||
\r
86 strcmp (query_string, "*") == 0)
\r
87 @@ -225,7 +219,7 @@ notmuch_query_search_messages_st (notmuch_query_t *query,
\r
88 final_query = mail_query;
\r
90 string_query = notmuch->query_parser->
\r
91 - parse_query (query_string, flags);
\r
92 + parse_query (query_string, NOTMUCH_QUERY_PARSER_FLAGS);
\r
93 final_query = Xapian::Query (Xapian::Query::OP_AND,
\r
94 mail_query, string_query);
\r
96 @@ -565,12 +559,6 @@ notmuch_query_count_messages_st (notmuch_query_t *query, unsigned *count_out)
\r
98 Xapian::Query string_query, final_query, exclude_query;
\r
100 - unsigned int flags = (Xapian::QueryParser::FLAG_BOOLEAN |
\r
101 - Xapian::QueryParser::FLAG_PHRASE |
\r
102 - Xapian::QueryParser::FLAG_LOVEHATE |
\r
103 - Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
\r
104 - Xapian::QueryParser::FLAG_WILDCARD |
\r
105 - Xapian::QueryParser::FLAG_PURE_NOT);
\r
107 if (strcmp (query_string, "") == 0 ||
\r
108 strcmp (query_string, "*") == 0)
\r
109 @@ -578,7 +566,7 @@ notmuch_query_count_messages_st (notmuch_query_t *query, unsigned *count_out)
\r
110 final_query = mail_query;
\r
112 string_query = notmuch->query_parser->
\r
113 - parse_query (query_string, flags);
\r
114 + parse_query (query_string, NOTMUCH_QUERY_PARSER_FLAGS);
\r
115 final_query = Xapian::Query (Xapian::Query::OP_AND,
\r
116 mail_query, string_query);
\r