From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 876C96DE1BA2 for ; Thu, 3 Sep 2015 12:40:46 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.436 X-Spam-Level: X-Spam-Status: No, score=-0.436 tagged_above=-999 required=5 tests=[AWL=0.284, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rYNw0f0TZc8B for ; Thu, 3 Sep 2015 12:40:45 -0700 (PDT) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by arlo.cworth.org (Postfix) with ESMTPS id 5EE916DE1603 for ; Thu, 3 Sep 2015 12:40:31 -0700 (PDT) Received: by wiclk2 with SMTP id lk2so19117989wic.1 for ; Thu, 03 Sep 2015 12:40:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=GitxrUYi7OnKyIbW4mMXWa9Ll04gxSDAPuoo+JHf0bI=; b=jBL0OcEq1O9Q6TZYWHKClp/5T3JGX7YEy6vzRgF496YIt5EJCjk9seRpM+oPoZPHZr 7hZUBXrMUtrWAn4U1jzrvuD314yOFWS3LJArTBDbrdpRpcDFjR8+iwwqvzYuzZnMmLZq 2XfYqI3E2dt4I5HnsrqV3XwTumhZGLurg+Ty/+n09WjjclWnA8Uym/UQZQoTIO24RqX9 GWRtsfS4DKUx4XEXwtFxdbyQQ3rvb5AC5rvJ3OfCnimlrlgCdNd5fKa+j3ICp/6TWld0 sTNhSxyWmQYFi1Qb+sPLkyacn60rvajoDKLCJs0YEOkjkh3L4Oh5aCCI4Ff64bMdhD7z KvOw== X-Gm-Message-State: ALoCoQmOyPGEdftEQ6yfja8ae8p+61i/38FieamLmctUMi+lls+DJOt0+657/K2ZqF+SebAL/n6N X-Received: by 10.194.250.40 with SMTP id yz8mr59364384wjc.37.1441309229962; Thu, 03 Sep 2015 12:40:29 -0700 (PDT) Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi. [188.238.79.131]) by smtp.gmail.com with ESMTPSA id i3sm35049480wja.42.2015.09.03.12.40.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2015 12:40:29 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH v2 9/9] cli: do not sort addresses on --output=count or --deduplicate=address Date: Thu, 3 Sep 2015 22:40:05 +0300 Message-Id: <01c4430a6715f72498b6f2d2b250523872531785.1441308761.git.jani@nikula.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Sep 2015 19:40:46 -0000 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. --- doc/man1/notmuch-address.rst | 4 +++- notmuch-search.c | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/man1/notmuch-address.rst b/doc/man1/notmuch-address.rst index b85cc37213e5..cbdb851980a8 100644 --- a/doc/man1/notmuch-address.rst +++ b/doc/man1/notmuch-address.rst @@ -85,7 +85,9 @@ Supported options for **address** include By default, results will be displayed in reverse chronological order, (that is, the newest results will be displayed first). - This option is not supported with --output=count. + However, if either --output=count or --deduplicate=address is + specified, this option is ignored and the order of the results + is unspecified. ``--exclude=(true|false)`` A message is called "excluded" if it matches at least one tag in diff --git a/notmuch-search.c b/notmuch-search.c index deb9e58a747c..b58496bf09d5 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -885,6 +885,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); -- 2.1.4