diff options
| author | David Bremner <david@tethera.net> | 2022-01-10 10:54:03 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2022-01-10 10:54:03 -0400 |
| commit | 1b58ea1e66997efdd7ea2a7a83f76890de40fe04 (patch) | |
| tree | 7db3d1aedaf2ae8e1ff0851ff8c56658273d074e /lib/query-fp.cc | |
| parent | 235b876793ec885b78c7b31904fd69d1a82fbe4a (diff) | |
| parent | 2394ee6289a2fc2628f198b4a9920116148dd814 (diff) | |
Merge tag 'debian/0.34.2-1' into debian/bullseye-backports
notmuch release 0.34.2-1 for unstable (sid) [dgit]
[dgit distro=debian no-split --quilt=linear]
Diffstat (limited to 'lib/query-fp.cc')
| -rw-r--r-- | lib/query-fp.cc | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/query-fp.cc b/lib/query-fp.cc index b980b7f0..75b1d875 100644 --- a/lib/query-fp.cc +++ b/lib/query-fp.cc @@ -24,17 +24,33 @@ #include "query-fp.h" #include <iostream> -Xapian::Query -QueryFieldProcessor::operator() (const std::string & name) +notmuch_status_t +_notmuch_query_name_to_query (notmuch_database_t *notmuch, const std::string name, + Xapian::Query &output) { std::string key = "query." + name; char *expansion; notmuch_status_t status; status = notmuch_database_get_config (notmuch, key.c_str (), &expansion); + if (status) + return status; + + output = notmuch->query_parser->parse_query (expansion, NOTMUCH_QUERY_PARSER_FLAGS); + return NOTMUCH_STATUS_SUCCESS; +} + +Xapian::Query +QueryFieldProcessor::operator() (const std::string & name) +{ + notmuch_status_t status; + Xapian::Query output; + + status = _notmuch_query_name_to_query (notmuch, name, output); if (status) { throw Xapian::QueryParserError ("error looking up key" + name); } - return parser.parse_query (expansion, NOTMUCH_QUERY_PARSER_FLAGS); + return output; + } |
