]> git.notmuchmail.org Git - notmuch/blobdiff - lib/message.cc
lib: define specialized get_thread_id for use in thread subquery
[notmuch] / lib / message.cc
index d5db89b6606c7da011c2a80c5ce460f769f32650..b2067076effb9981c56a16ffdbd2ca4fdbe1c849 100644 (file)
@@ -318,6 +318,23 @@ _notmuch_message_get_term (notmuch_message_t *message,
     return value;
 }
 
+/*
+ * For special applications where we only want the thread id, reading
+ * in all metadata is a heavy I/O penalty.
+ */
+const char *
+_notmuch_message_get_thread_id_only (notmuch_message_t *message)
+{
+
+    Xapian::TermIterator i = message->doc.termlist_begin ();
+    Xapian::TermIterator end = message->doc.termlist_end ();
+
+    message->thread_id = _notmuch_message_get_term (message, i, end,
+                                                   _find_prefix ("thread"));
+    return message->thread_id;
+}
+
+
 static void
 _notmuch_message_ensure_metadata (notmuch_message_t *message, void *field)
 {