diff options
author | Jani Nikula <jani@nikula.org> | 2015-09-03 22:40:05 +0300 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2015-09-26 07:41:05 -0300 |
commit | 02e394aed216622ac355ff15bae74403abf40417 (patch) | |
tree | 7e0c5b1e674a2cf55f4cd50982b697815897ba46 /notmuch-search.c | |
parent | 71fae18fba8934186a9a067daa9bcba951eb28b1 (diff) |
cli: do not sort addresses on --output=count or --deduplicate=address
The order of the results with --output=count and --deduplicate=address
are unspecified as they're based on a hash table traversal. This being
the case, optimize the query by explicitly requesting unsorted
results. Clarify the documentation accordingly.
Diffstat (limited to 'notmuch-search.c')
-rw-r--r-- | notmuch-search.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/notmuch-search.c b/notmuch-search.c index 2eaad32f..44e582cb 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -883,6 +883,11 @@ notmuch_address_command (notmuch_config_t *config, int argc, char *argv[]) _talloc_free_for_g_hash, _list_free_for_g_hash); + /* The order is not guaranteed if a full pass is required, so go + * for fastest. */ + if (ctx->output & OUTPUT_COUNT || ctx->dedup == DEDUP_ADDRESS) + notmuch_query_set_sort (ctx->query, NOTMUCH_SORT_UNSORTED); + ret = do_search_messages (ctx); g_hash_table_unref (ctx->addresses); |