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 DE3126DE098A
\r
6 for <notmuch@notmuchmail.org>; Sat, 7 May 2016 17:05:37 -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 g8KkzRilCNcU for <notmuch@notmuchmail.org>;
\r
17 Sat, 7 May 2016 17:05:30 -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 F1E3C6DE0217
\r
20 for <notmuch@notmuchmail.org>; Sat, 7 May 2016 17:05:04 -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 1azCDS-000157-TJ; Sat, 07 May 2016 20:04:58 -0400
\r
24 Received: (nullmailer pid 17201 invoked by uid 1000);
\r
25 Sun, 08 May 2016 00:04:53 -0000
\r
26 From: David Bremner <david@tethera.net>
\r
27 To: notmuch@notmuchmail.org
\r
28 Subject: [Patch v4 10/12] lib: make a global constant for query parser flags
\r
29 Date: Sat, 7 May 2016 21:04:47 -0300
\r
30 Message-Id: <1462665889-17121-11-git-send-email-david@tethera.net>
\r
31 X-Mailer: git-send-email 2.8.1
\r
32 In-Reply-To: <1462665889-17121-1-git-send-email-david@tethera.net>
\r
33 References: <1462665889-17121-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: Sun, 08 May 2016 00:05:38 -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