mirror of https://github.com/djcb/mu.git
* mu-query: create the query in a smarter way, which makes --include-related *much* faster
This commit is contained in:
parent
e70f66647c
commit
e456998e7d
|
@ -422,7 +422,7 @@ get_related_query (MuMsgIter *iter)
|
|||
{
|
||||
GHashTable *hash;
|
||||
GList *id_list, *cur;
|
||||
Xapian::Query query;
|
||||
std::vector<Xapian::Query> qvec;
|
||||
static std::string pfx (1, mu_msg_field_xapian_prefix
|
||||
(MU_MSG_FIELD_ID_THREAD_ID));
|
||||
|
||||
|
@ -432,20 +432,16 @@ get_related_query (MuMsgIter *iter)
|
|||
* References. */
|
||||
id_list = g_hash_table_get_keys (hash);
|
||||
|
||||
/* now, let's create a new query matching all of those */
|
||||
// g_print ("list: %u\n", (unsigned) g_list_length (id_list));
|
||||
for (cur = id_list; cur; cur = g_list_next(cur)) {
|
||||
query = Xapian::Query (Xapian::Query::OP_OR,
|
||||
query,
|
||||
Xapian::Query((std::string
|
||||
(pfx + (char*)cur->data))));
|
||||
}
|
||||
// now, we create a vector with queries for each of the
|
||||
// thread-ids, which we combine below. This is /much/ faster
|
||||
// than creating the query as 'query = Query (OR, query)'...
|
||||
for (cur = id_list; cur; cur = g_list_next(cur))
|
||||
qvec.push_back (Xapian::Query((std::string (pfx + (char*)cur->data))));
|
||||
|
||||
g_hash_table_destroy (hash);
|
||||
g_list_free (id_list);
|
||||
|
||||
/* now, `query' should match all related messages */
|
||||
return query;
|
||||
return Xapian::Query (Xapian::Query::OP_OR, qvec.begin(), qvec.end());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -439,7 +439,7 @@ same message, which is a common occurence when using e.g. Gmail together with
|
|||
the matched messages -- i.e.. include messages that are part of the same
|
||||
message thread as some matched messages. This is useful if you want
|
||||
Gmail-style 'conversations'. Note, finding these related messages can take a
|
||||
bit of time if there are more than a thousand matches.
|
||||
bit of time if there are thousands of matches.
|
||||
|
||||
.TP
|
||||
\fB\-t\fR, \fB\-\-threads\fR show messages in a 'threaded' format -- that is,
|
||||
|
|
Loading…
Reference in New Issue