aboutsummaryrefslogtreecommitdiff
path: root/lib/message.cc
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2018-01-27 22:50:42 -0400
committerDavid Bremner <david@tethera.net>2018-05-07 08:42:53 -0300
commitf0131af6c59704e29d58eb74ed5e4bc298455272 (patch)
tree83cfcee082a013335e9850fe1fad99c36be49c63 /lib/message.cc
parent60fcec82d2a8041ba3ee9fc6413cd404659e38dc (diff)
lib: define specialized get_thread_id for use in thread subquery
The observation is that we are only using the messages to get there thread_id, which is kindof a pessimal access pattern for the current notmuch_message_get_thread_id
Diffstat (limited to 'lib/message.cc')
-rw-r--r--lib/message.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/message.cc b/lib/message.cc
index d5db89b6..b2067076 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -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)
{