1 Return-Path: <bremner@tethera.net>
\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 F23246DE096D
\r
6 for <notmuch@notmuchmail.org>; Fri, 13 May 2016 03:39:09 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-0.013 tagged_above=-999 required=5
\r
12 tests=[AWL=-0.002, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01]
\r
14 Received: from arlo.cworth.org ([127.0.0.1])
\r
15 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id iF6isvrOyA6N for <notmuch@notmuchmail.org>;
\r
17 Fri, 13 May 2016 03:39:02 -0700 (PDT)
\r
18 Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])
\r
19 by arlo.cworth.org (Postfix) with ESMTPS id B336D6DE0355
\r
20 for <notmuch@notmuchmail.org>; Fri, 13 May 2016 03:38:30 -0700 (PDT)
\r
21 Received: from remotemail by fethera.tethera.net with local (Exim 4.84)
\r
22 (envelope-from <bremner@tethera.net>)
\r
23 id 1b1AUB-0003Pj-Oa; Fri, 13 May 2016 06:38:23 -0400
\r
24 Received: (nullmailer pid 7564 invoked by uid 1000);
\r
25 Fri, 13 May 2016 10:38:17 -0000
\r
26 From: David Bremner <david@tethera.net>
\r
27 To: notmuch@notmuchmail.org
\r
28 Subject: [Patch v5 10/11] lib: make a global constant for query parser flags
\r
29 Date: Fri, 13 May 2016 07:38:12 -0300
\r
30 Message-Id: <1463135893-7471-11-git-send-email-david@tethera.net>
\r
31 X-Mailer: git-send-email 2.8.1
\r
32 In-Reply-To: <1463135893-7471-1-git-send-email-david@tethera.net>
\r
33 References: <1463135893-7471-1-git-send-email-david@tethera.net>
\r
34 X-BeenThere: notmuch@notmuchmail.org
\r
35 X-Mailman-Version: 2.1.20
\r
37 List-Id: "Use and development of the notmuch mail system."
\r
38 <notmuch.notmuchmail.org>
\r
39 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
40 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
42 List-Post: <mailto:notmuch@notmuchmail.org>
\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
44 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
46 X-List-Received-Date: Fri, 13 May 2016 10:39:10 -0000
\r
48 It's already kindof gross that this is hardcoded in two different
\r
49 places. We will also need these later in field processors calling back
\r
50 into the query parser.
\r
52 lib/database-private.h | 7 +++++++
\r
53 lib/query.cc | 16 ++--------------
\r
54 2 files changed, 9 insertions(+), 14 deletions(-)
\r
56 diff --git a/lib/database-private.h b/lib/database-private.h
\r
57 index e1962f4..d2990b6 100644
\r
58 --- a/lib/database-private.h
\r
59 +++ b/lib/database-private.h
\r
60 @@ -144,6 +144,13 @@ operator&=(_notmuch_features &a, _notmuch_features b)
\r
64 +#define NOTMUCH_QUERY_PARSER_FLAGS (Xapian::QueryParser::FLAG_BOOLEAN | \
\r
65 + Xapian::QueryParser::FLAG_PHRASE | \
\r
66 + Xapian::QueryParser::FLAG_LOVEHATE | \
\r
67 + Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE | \
\r
68 + Xapian::QueryParser::FLAG_WILDCARD | \
\r
69 + Xapian::QueryParser::FLAG_PURE_NOT)
\r
71 struct _notmuch_database {
\r
72 notmuch_bool_t exception_reported;
\r
74 diff --git a/lib/query.cc b/lib/query.cc
\r
75 index 77a7926..0875b0e 100644
\r
78 @@ -220,12 +220,6 @@ _notmuch_query_search_documents (notmuch_query_t *query,
\r
79 Xapian::Query string_query, final_query, exclude_query;
\r
81 Xapian::MSetIterator iterator;
\r
82 - unsigned int flags = (Xapian::QueryParser::FLAG_BOOLEAN |
\r
83 - Xapian::QueryParser::FLAG_PHRASE |
\r
84 - Xapian::QueryParser::FLAG_LOVEHATE |
\r
85 - Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
\r
86 - Xapian::QueryParser::FLAG_WILDCARD |
\r
87 - Xapian::QueryParser::FLAG_PURE_NOT);
\r
89 if (strcmp (query_string, "") == 0 ||
\r
90 strcmp (query_string, "*") == 0)
\r
91 @@ -233,7 +227,7 @@ _notmuch_query_search_documents (notmuch_query_t *query,
\r
92 final_query = mail_query;
\r
94 string_query = notmuch->query_parser->
\r
95 - parse_query (query_string, flags);
\r
96 + parse_query (query_string, NOTMUCH_QUERY_PARSER_FLAGS);
\r
97 final_query = Xapian::Query (Xapian::Query::OP_AND,
\r
98 mail_query, string_query);
\r
100 @@ -579,12 +573,6 @@ _notmuch_query_count_documents (notmuch_query_t *query, const char *type, unsign
\r
102 Xapian::Query string_query, final_query, exclude_query;
\r
104 - unsigned int flags = (Xapian::QueryParser::FLAG_BOOLEAN |
\r
105 - Xapian::QueryParser::FLAG_PHRASE |
\r
106 - Xapian::QueryParser::FLAG_LOVEHATE |
\r
107 - Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
\r
108 - Xapian::QueryParser::FLAG_WILDCARD |
\r
109 - Xapian::QueryParser::FLAG_PURE_NOT);
\r
111 if (strcmp (query_string, "") == 0 ||
\r
112 strcmp (query_string, "*") == 0)
\r
113 @@ -592,7 +580,7 @@ _notmuch_query_count_documents (notmuch_query_t *query, const char *type, unsign
\r
114 final_query = mail_query;
\r
116 string_query = notmuch->query_parser->
\r
117 - parse_query (query_string, flags);
\r
118 + parse_query (query_string, NOTMUCH_QUERY_PARSER_FLAGS);
\r
119 final_query = Xapian::Query (Xapian::Query::OP_AND,
\r
120 mail_query, string_query);
\r