Use _find_prefix instead of hard-coded term in notmuch_query_search
authorCarl Worth <cworth@cworth.org>
Sun, 25 Oct 2009 05:21:57 +0000 (22:21 -0700)
committerCarl Worth <cworth@cworth.org>
Sun, 25 Oct 2009 05:21:57 +0000 (22:21 -0700)
I'm planning to change prefix values soon, which would break code
like this. So eliminate the fragility by going through our existing
_find_prefix function.

query.cc

index 5750167580c0f94ecf0eae11a18aef7ce399300d..ae986d35c9d1499bfb5695a252959a054a18357b 100644 (file)
--- a/query.cc
+++ b/query.cc
@@ -92,7 +92,9 @@ notmuch_query_search (notmuch_query_t *query)
 
     try {
        Xapian::Enquire enquire (*notmuch->xapian_db);
-       Xapian::Query mail_query ("Kmail");
+       Xapian::Query mail_query (talloc_asprintf (query, "%s%s",
+                                                  _find_prefix ("type"),
+                                                  "mail"));
        Xapian::Query string_query, final_query;
        Xapian::MSet mset;
        unsigned int flags = (Xapian::QueryParser::FLAG_BOOLEAN |