summaryrefslogtreecommitdiff
path: root/query.cc
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-10-24 22:18:20 -0700
committerCarl Worth <cworth@cworth.org>2009-10-24 22:18:20 -0700
commit526b7144f7d692e04ce950dfa7d0ee1bdf792cdc (patch)
tree25a73ced7064fe21b5095e62b7b2f659083fb622 /query.cc
parent144b2cbc5532e000c37b4d5ba7bb5d9ea113859f (diff)
Add debugging code for examining query strings.
It's nice that Xapian provides a little function to print a textual representation of the entire query tree. So now, if you compile like so: make CFLAGS=-DDEBUG_QUERY then you get a nice output of the query string received by the query module, and the final query actually being sent to Xapian.
Diffstat (limited to 'query.cc')
-rw-r--r--query.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/query.cc b/query.cc
index a15de96..f66ee55 100644
--- a/query.cc
+++ b/query.cc
@@ -41,6 +41,10 @@ notmuch_query_create (notmuch_database_t *notmuch,
{
notmuch_query_t *query;
+#ifdef DEBUG_QUERY
+ fprintf (stderr, "Query string is:\n%s\n", query_string);
+#endif
+
query = talloc (NULL, notmuch_query_t);
if (unlikely (query == NULL))
return NULL;
@@ -118,6 +122,10 @@ notmuch_query_search (notmuch_query_t *query)
break;
}
+#if DEBUG_QUERY
+ fprintf (stderr, "Final query is:\n%s\n", final_query.get_description().c_str());
+#endif
+
enquire.set_query (final_query);
mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount ());