From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [WIP2 1/5] lib: rename _debug_query to _notmuch_query_debug, make extern
Date: Sat, 31 Aug 2019 22:37:44 -0300 [thread overview]
Message-ID: <20190901013748.7470-2-david@tethera.net> (raw)
In-Reply-To: <20190901013748.7470-1-david@tethera.net>
This makes it available for use within the field processors.
---
lib/notmuch-private.h | 5 +++++
lib/query.cc | 10 +++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index 9bdb68ab..f0657147 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -519,6 +519,11 @@ void
_notmuch_doc_id_set_remove (notmuch_doc_id_set_t *doc_ids,
unsigned int doc_id);
+/* utility function to control debugging output */
+
+bool
+_notmuch_query_debug ();
+
/* querying xapian documents by type (e.g. "mail" or "ghost"): */
notmuch_status_t
_notmuch_query_search_documents (notmuch_query_t *query,
diff --git a/lib/query.cc b/lib/query.cc
index 792aba21..7b815dc5 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -67,8 +67,8 @@ _notmuch_doc_id_set_init (void *ctx,
notmuch_doc_id_set_t *doc_ids,
GArray *arr);
-static bool
-_debug_query (void)
+bool
+_notmuch_query_debug (void)
{
char *env = getenv ("NOTMUCH_DEBUG_QUERY");
@@ -90,7 +90,7 @@ notmuch_query_create (notmuch_database_t *notmuch,
{
notmuch_query_t *query;
- if (_debug_query ())
+ if (_notmuch_query_debug ())
fprintf (stderr, "Query string is:\n%s\n", query_string);
query = talloc (notmuch, notmuch_query_t);
@@ -334,7 +334,7 @@ _notmuch_query_search_documents (notmuch_query_t *query,
break;
}
- if (_debug_query ()) {
+ if (_notmuch_query_debug ()) {
fprintf (stderr, "Exclude query is:\n%s\n",
exclude_query.get_description ().c_str ());
fprintf (stderr, "Final query is:\n%s\n",
@@ -638,7 +638,7 @@ _notmuch_query_count_documents (notmuch_query_t *query, const char *type, unsign
enquire.set_weighting_scheme (Xapian::BoolWeight ());
enquire.set_docid_order (Xapian::Enquire::ASCENDING);
- if (_debug_query ()) {
+ if (_notmuch_query_debug ()) {
fprintf (stderr, "Exclude query is:\n%s\n",
exclude_query.get_description ().c_str ());
fprintf (stderr, "Final query is:\n%s\n",
--
2.23.0.rc1
next prev parent reply other threads:[~2019-09-01 1:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-01 1:37 WIP: fixes for implicit operators and subqueries David Bremner
2019-09-01 1:37 ` David Bremner [this message]
2019-09-01 1:37 ` [WIP2 2/5] test: add known broken tests for implicit operators David Bremner
2019-09-01 1:37 ` [WIP2 3/5] lib: introduce N_F_GROUP and use it to fix implicit AND for from: David Bremner
2019-09-01 1:37 ` [WIP2 4/5] test: add known broken tests for parenthesized subqueries David Bremner
2019-09-01 1:37 ` [WIP2 5/5] lib: special case parenthesized subqueries in regex fields 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=20190901013748.7470-2-david@tethera.net \
--to=david@tethera.net \
--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).