#include <glib.h> /* GHashTable, GPtrArray */
-#include <xapian.h>
-
struct _notmuch_query {
notmuch_database_t *notmuch;
const char *query_string;
return query;
}
+const char *
+notmuch_query_get_query_string (notmuch_query_t *query)
+{
+ return query->query_string;
+}
+
void
notmuch_query_set_sort (notmuch_query_t *query, notmuch_sort_t sort)
{
query->sort = sort;
}
+notmuch_sort_t
+notmuch_query_get_sort (notmuch_query_t *query)
+{
+ return query->sort;
+}
+
/* We end up having to call the destructors explicitly because we had
* to use "placement new" in order to initialize C++ objects within a
* block that we allocated with talloc. So C++ is making talloc
messages->iterator = mset.begin ();
messages->iterator_end = mset.end ();
+ return &messages->base;
+
} catch (const Xapian::Error &error) {
fprintf (stderr, "A Xapian exception occurred performing query: %s\n",
error.get_msg().c_str());
fprintf (stderr, "Query string was: %s\n", query->query_string);
notmuch->exception_reported = TRUE;
+ talloc_free (messages);
+ return NULL;
}
-
- return &messages->base;
}
notmuch_bool_t
free, NULL);
threads->messages = notmuch_query_search_messages (query);
+ if (threads->messages == NULL) {
+ talloc_free (threads);
+ return NULL;
+ }
threads->thread_id = NULL;