+ * Note: If you are finished with a thread before its containing
+ * query, you can call notmuch_thread_destroy to clean up some memory
+ * sooner (as in the above example). Otherwise, if your thread objects
+ * are long-lived, then you don't need to call notmuch_thread_destroy
+ * and all the memory will still be reclaimed when the query is
+ * destroyed.
+ *
+ * Note that there's no explicit destructor needed for the
+ * notmuch_thread_results_t object. (For consistency, we do provide a
+ * notmuch_thread_results_destroy function, but there's no good reason
+ * to call it if the query is about to be destroyed).
+ */
+notmuch_thread_results_t *
+notmuch_query_search_threads (notmuch_query_t *query);
+
+/* Execute a query for messages, returning a notmuch_message_results_t
+ * object which can be used to iterate over the results. The results
+ * object is owned by the query and as such, will only be valid until
+ * notmuch_query_destroy.
+ *
+ * Typical usage might be:
+ *
+ * notmuch_query_t *query;
+ * notmuch_message_results_t *results;
+ * notmuch_message_t *message;
+ *
+ * query = notmuch_query_create (database, query_string);
+ *
+ * for (results = notmuch_query_search_messages (query);
+ * notmuch_message_results_has_more (results);
+ * notmuch_message_results_advance (results))
+ * {
+ * message = notmuch_message_results_get (results);
+ * ....
+ * notmuch_message_destroy (message);
+ * }
+ *
+ * notmuch_query_destroy (query);
+ *
+ * Note: If you are finished with a message before its containing
+ * query, you can call notmuch_message_destroy to clean up some memory
+ * sooner (as in the above example). Otherwise, if your message
+ * objects are long-lived, then you don't need to call
+ * notmuch_message_destroy and all the memory will still be reclaimed
+ * when the query is destroyed.
+ *
+ * Note that there's no explicit destructor needed for the
+ * notmuch_message_results_t object. (For consistency, we do provide a
+ * notmuch_message_results_destroy function, but there's no good
+ * reason to call it if the query is about to be destroyed).