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 4C80F6DE094A
\r
6 for <notmuch@notmuchmail.org>; Sat, 30 Apr 2016 18:25:27 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-0.015 tagged_above=-999 required=5
\r
12 tests=[AWL=-0.004, 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 KXhKCW3fgbUG for <notmuch@notmuchmail.org>;
\r
17 Sat, 30 Apr 2016 18:25:19 -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 482546DE0360
\r
20 for <notmuch@notmuchmail.org>; Sat, 30 Apr 2016 18:24:54 -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 1awg7t-0006cd-9W; Sat, 30 Apr 2016 21:24:49 -0400
\r
24 Received: (nullmailer pid 29959 invoked by uid 1000);
\r
25 Sun, 01 May 2016 01:24:43 -0000
\r
26 From: David Bremner <david@tethera.net>
\r
27 To: notmuch@notmuchmail.org
\r
28 Subject: [Patch v3 10/11] lib: make a global constant for query parser flags
\r
29 Date: Sat, 30 Apr 2016 22:24:38 -0300
\r
30 Message-Id: <1462065879-29860-11-git-send-email-david@tethera.net>
\r
31 X-Mailer: git-send-email 2.8.0.rc3
\r
32 In-Reply-To: <1462065879-29860-1-git-send-email-david@tethera.net>
\r
33 References: <1462065879-29860-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, 01 May 2016 01:25:27 -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 | 4 ++++
\r
53 lib/query.cc | 16 ++--------------
\r
54 2 files changed, 6 insertions(+), 14 deletions(-)
\r
56 diff --git a/lib/database-private.h b/lib/database-private.h
\r
57 index e1962f4..b5c1f90 100644
\r
58 --- a/lib/database-private.h
\r
59 +++ b/lib/database-private.h
\r
60 @@ -144,6 +144,10 @@ operator&=(_notmuch_features &a, _notmuch_features b)
\r
64 +#define NOTMUCH_QUERY_PARSER_FLAGS (Xapian::QueryParser::FLAG_BOOLEAN | Xapian::QueryParser::FLAG_PHRASE | \
\r
65 + Xapian::QueryParser::FLAG_LOVEHATE | Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE | \
\r
66 + Xapian::QueryParser::FLAG_WILDCARD | Xapian::QueryParser::FLAG_PURE_NOT)
\r
68 struct _notmuch_database {
\r
69 notmuch_bool_t exception_reported;
\r
71 diff --git a/lib/query.cc b/lib/query.cc
\r
72 index 77a7926..0875b0e 100644
\r
75 @@ -220,12 +220,6 @@ _notmuch_query_search_documents (notmuch_query_t *query,
\r
76 Xapian::Query string_query, final_query, exclude_query;
\r
78 Xapian::MSetIterator iterator;
\r
79 - unsigned int flags = (Xapian::QueryParser::FLAG_BOOLEAN |
\r
80 - Xapian::QueryParser::FLAG_PHRASE |
\r
81 - Xapian::QueryParser::FLAG_LOVEHATE |
\r
82 - Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
\r
83 - Xapian::QueryParser::FLAG_WILDCARD |
\r
84 - Xapian::QueryParser::FLAG_PURE_NOT);
\r
86 if (strcmp (query_string, "") == 0 ||
\r
87 strcmp (query_string, "*") == 0)
\r
88 @@ -233,7 +227,7 @@ _notmuch_query_search_documents (notmuch_query_t *query,
\r
89 final_query = mail_query;
\r
91 string_query = notmuch->query_parser->
\r
92 - parse_query (query_string, flags);
\r
93 + parse_query (query_string, NOTMUCH_QUERY_PARSER_FLAGS);
\r
94 final_query = Xapian::Query (Xapian::Query::OP_AND,
\r
95 mail_query, string_query);
\r
97 @@ -579,12 +573,6 @@ _notmuch_query_count_documents (notmuch_query_t *query, const char *type, unsign
\r
99 Xapian::Query string_query, final_query, exclude_query;
\r
101 - unsigned int flags = (Xapian::QueryParser::FLAG_BOOLEAN |
\r
102 - Xapian::QueryParser::FLAG_PHRASE |
\r
103 - Xapian::QueryParser::FLAG_LOVEHATE |
\r
104 - Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
\r
105 - Xapian::QueryParser::FLAG_WILDCARD |
\r
106 - Xapian::QueryParser::FLAG_PURE_NOT);
\r
108 if (strcmp (query_string, "") == 0 ||
\r
109 strcmp (query_string, "*") == 0)
\r
110 @@ -592,7 +580,7 @@ _notmuch_query_count_documents (notmuch_query_t *query, const char *type, unsign
\r
111 final_query = mail_query;
\r
113 string_query = notmuch->query_parser->
\r
114 - parse_query (query_string, flags);
\r
115 + parse_query (query_string, NOTMUCH_QUERY_PARSER_FLAGS);
\r
116 final_query = Xapian::Query (Xapian::Query::OP_AND,
\r
117 mail_query, string_query);
\r