From: michaeljgruber+grubix+git@gmail.com
To: notmuch@notmuchmail.org
Cc: Michael J Gruber <git@grubix.eu>
Subject: [PATCH] fix build without sfsexp
Date: Fri, 15 Apr 2022 18:23:46 +0200 [thread overview]
Message-ID: <50cd016213f4fbff4330ff27b05761c418bceb4c.1650039637.git.git@grubix.eu> (raw)
In-Reply-To: <CAA19uiRpGpTTPsoMRJtaUO8077gh6MyGYgSagRH-h4ewQBa9Gg@mail.gmail.com>
From: Michael J Gruber <git@grubix.eu>
a1d139de ("lib: add sexp: prefix to Xapian (infix) query parser.",
2022-04-09) introduced sfsexp infix queries. This requires the infix
preprocessor to be built in in a way which does not require sfsexp when
notmuch is built without it.
Make the preprocessor throw a Xapian error in this case (and fix the
build).
Signed-off-by: Michael J Gruber <git@grubix.eu>
---
Maybe something like this - I have not test *with* sfsexp, though.
lib/database-private.h | 4 ----
lib/query.cc | 2 ++
lib/sexp-fp.cc | 4 ++++
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/database-private.h b/lib/database-private.h
index 657b1aa1..419b9fe6 100644
--- a/lib/database-private.h
+++ b/lib/database-private.h
@@ -354,10 +354,6 @@ _notmuch_query_string_to_xapian_query (notmuch_database_t *notmuch,
std::string query_string,
Xapian::Query &output,
std::string &msg);
-/* parse-sexp.cc */
-notmuch_status_t
-_notmuch_sexp_string_to_xapian_query (notmuch_database_t *notmuch, const char *querystr,
- Xapian::Query &output);
notmuch_status_t
_notmuch_query_expand (notmuch_database_t *notmuch, const char *field, Xapian::Query subquery,
diff --git a/lib/query.cc b/lib/query.cc
index b0937fcc..707f6222 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -227,6 +227,7 @@ _notmuch_query_ensure_parsed_xapian (notmuch_query_t *query)
return NOTMUCH_STATUS_SUCCESS;
}
+#if HAVE_SFSEXP
static notmuch_status_t
_notmuch_query_ensure_parsed_sexpr (notmuch_query_t *query)
{
@@ -243,6 +244,7 @@ _notmuch_query_ensure_parsed_sexpr (notmuch_query_t *query)
_notmuch_query_cache_terms (query);
return NOTMUCH_STATUS_SUCCESS;
}
+#endif
static notmuch_status_t
_notmuch_query_ensure_parsed (notmuch_query_t *query)
diff --git a/lib/sexp-fp.cc b/lib/sexp-fp.cc
index ed26f6ec..1fdf5225 100644
--- a/lib/sexp-fp.cc
+++ b/lib/sexp-fp.cc
@@ -30,10 +30,14 @@ SexpFieldProcessor::operator() (const std::string & query_string)
notmuch_status_t status;
Xapian::Query output;
+#if HAVE_SFSEXP
status = _notmuch_sexp_string_to_xapian_query (notmuch, query_string.c_str (), output);
if (status) {
throw Xapian::QueryParserError ("error parsing " + query_string);
}
+#else
+ throw Xapian::QueryParserError ("sexp query parser not available");
+#endif
return output;
--
2.36.0.rc2.472.gf6a51f5f41
next prev parent reply other threads:[~2022-04-15 16:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-09 19:45 v2 allow sexp queries in infix parser David Bremner
2022-04-09 19:45 ` [PATCH v2 1/2] test/sexp: add test for and of stemmed terms David Bremner
2022-04-09 19:45 ` [PATCH v2 2/2] lib: add sexp: prefix to Xapian (infix) query parser David Bremner
2022-04-15 11:32 ` David Bremner
2022-04-15 16:03 ` Michael J Gruber
2022-04-15 16:23 ` michaeljgruber+grubix+git [this message]
2022-04-15 17:31 ` [PATCH] fix build without sfsexp David Bremner
2022-04-15 17:03 ` [PATCH] lib: don't compile sexp: prefix if no sfsexp library David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50cd016213f4fbff4330ff27b05761c418bceb4c.1650039637.git.git@grubix.eu \
--to=michaeljgruber+grubix+git@gmail.com \
--cc=git@grubix.eu \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).