mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 10:58:10 +01:00
lib: make a global constant for query parser flags
It's already kindof gross that this is hardcoded in two different places. We will also need these later in field processors calling back into the query parser.
This commit is contained in:
parent
2d2a13966c
commit
30caaf52b0
2 changed files with 9 additions and 14 deletions
|
@ -144,6 +144,13 @@ operator&=(_notmuch_features &a, _notmuch_features b)
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define NOTMUCH_QUERY_PARSER_FLAGS (Xapian::QueryParser::FLAG_BOOLEAN | \
|
||||||
|
Xapian::QueryParser::FLAG_PHRASE | \
|
||||||
|
Xapian::QueryParser::FLAG_LOVEHATE | \
|
||||||
|
Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE | \
|
||||||
|
Xapian::QueryParser::FLAG_WILDCARD | \
|
||||||
|
Xapian::QueryParser::FLAG_PURE_NOT)
|
||||||
|
|
||||||
struct _notmuch_database {
|
struct _notmuch_database {
|
||||||
notmuch_bool_t exception_reported;
|
notmuch_bool_t exception_reported;
|
||||||
|
|
||||||
|
|
16
lib/query.cc
16
lib/query.cc
|
@ -220,12 +220,6 @@ _notmuch_query_search_documents (notmuch_query_t *query,
|
||||||
Xapian::Query string_query, final_query, exclude_query;
|
Xapian::Query string_query, final_query, exclude_query;
|
||||||
Xapian::MSet mset;
|
Xapian::MSet mset;
|
||||||
Xapian::MSetIterator iterator;
|
Xapian::MSetIterator iterator;
|
||||||
unsigned int flags = (Xapian::QueryParser::FLAG_BOOLEAN |
|
|
||||||
Xapian::QueryParser::FLAG_PHRASE |
|
|
||||||
Xapian::QueryParser::FLAG_LOVEHATE |
|
|
||||||
Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
|
|
||||||
Xapian::QueryParser::FLAG_WILDCARD |
|
|
||||||
Xapian::QueryParser::FLAG_PURE_NOT);
|
|
||||||
|
|
||||||
if (strcmp (query_string, "") == 0 ||
|
if (strcmp (query_string, "") == 0 ||
|
||||||
strcmp (query_string, "*") == 0)
|
strcmp (query_string, "*") == 0)
|
||||||
|
@ -233,7 +227,7 @@ _notmuch_query_search_documents (notmuch_query_t *query,
|
||||||
final_query = mail_query;
|
final_query = mail_query;
|
||||||
} else {
|
} else {
|
||||||
string_query = notmuch->query_parser->
|
string_query = notmuch->query_parser->
|
||||||
parse_query (query_string, flags);
|
parse_query (query_string, NOTMUCH_QUERY_PARSER_FLAGS);
|
||||||
final_query = Xapian::Query (Xapian::Query::OP_AND,
|
final_query = Xapian::Query (Xapian::Query::OP_AND,
|
||||||
mail_query, string_query);
|
mail_query, string_query);
|
||||||
}
|
}
|
||||||
|
@ -579,12 +573,6 @@ _notmuch_query_count_documents (notmuch_query_t *query, const char *type, unsign
|
||||||
type));
|
type));
|
||||||
Xapian::Query string_query, final_query, exclude_query;
|
Xapian::Query string_query, final_query, exclude_query;
|
||||||
Xapian::MSet mset;
|
Xapian::MSet mset;
|
||||||
unsigned int flags = (Xapian::QueryParser::FLAG_BOOLEAN |
|
|
||||||
Xapian::QueryParser::FLAG_PHRASE |
|
|
||||||
Xapian::QueryParser::FLAG_LOVEHATE |
|
|
||||||
Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
|
|
||||||
Xapian::QueryParser::FLAG_WILDCARD |
|
|
||||||
Xapian::QueryParser::FLAG_PURE_NOT);
|
|
||||||
|
|
||||||
if (strcmp (query_string, "") == 0 ||
|
if (strcmp (query_string, "") == 0 ||
|
||||||
strcmp (query_string, "*") == 0)
|
strcmp (query_string, "*") == 0)
|
||||||
|
@ -592,7 +580,7 @@ _notmuch_query_count_documents (notmuch_query_t *query, const char *type, unsign
|
||||||
final_query = mail_query;
|
final_query = mail_query;
|
||||||
} else {
|
} else {
|
||||||
string_query = notmuch->query_parser->
|
string_query = notmuch->query_parser->
|
||||||
parse_query (query_string, flags);
|
parse_query (query_string, NOTMUCH_QUERY_PARSER_FLAGS);
|
||||||
final_query = Xapian::Query (Xapian::Query::OP_AND,
|
final_query = Xapian::Query (Xapian::Query::OP_AND,
|
||||||
mail_query, string_query);
|
mail_query, string_query);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue