From b15d2ac0c5cf0e48345dc5be82b916b5b1f5ce3f Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Fri, 6 Apr 2012 13:49:06 +0100 Subject: [PATCH] [PATCH v3 1/6] lib: change default for notmuch_query_set_omit_excluded --- 31/5ec99a6cc8939bedb179d7fa88fe73e670b01a | 149 ++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 31/5ec99a6cc8939bedb179d7fa88fe73e670b01a diff --git a/31/5ec99a6cc8939bedb179d7fa88fe73e670b01a b/31/5ec99a6cc8939bedb179d7fa88fe73e670b01a new file mode 100644 index 000000000..470aa2031 --- /dev/null +++ b/31/5ec99a6cc8939bedb179d7fa88fe73e670b01a @@ -0,0 +1,149 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 908B9431FB6 + for ; Fri, 6 Apr 2012 05:49:16 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id s+y4bufLmlYg for ; + Fri, 6 Apr 2012 05:49:16 -0700 (PDT) +Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com + [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + C042C431FAE for ; Fri, 6 Apr 2012 05:49:15 -0700 + (PDT) +Received: by wgbdt14 with SMTP id dt14so188823wgb.2 + for ; Fri, 06 Apr 2012 05:49:14 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; + bh=evWbal5TZwC83T81p5PIhFxgGHmqMjVz7PLu6Fut7js=; + b=KS3wkamNhPcWIiqwdAT0rlz0uqX5mF2vb8q4OqnnSsoVHW+ChK3bwEseEHQyMA87C6 + 1bpmG8QmOOiy/PqpN7iuU2vlkkZ9RPRGo224lKI3nJNWfxIznFVQznAeMSQOUsh0pd2m + FmjnMzJojeoW+6Zym1xllxYtf6nX2QISSPJWIVzk9XhqJ53M2FMhplxdrvVc4RGJIOGs + FTOLrSmruNxVtxu0uz564i1nDj6Nq4zVsli9F/5JzIl3jtYb+WKc7J+QKrD2qlWi04D1 + BGIvjUC7osRzH17n3MekeUfqe7xdEU9yrwS90BmbhXrgKg2tfRsoMiVG/C2gvy3r13wj + K9EQ== +Received: by 10.216.136.131 with SMTP id w3mr3963991wei.15.1333716554509; + Fri, 06 Apr 2012 05:49:14 -0700 (PDT) +Received: from localhost (94-192-233-223.zone6.bethere.co.uk. + [94.192.233.223]) by mx.google.com with ESMTPS id + j3sm10207675wiw.1.2012.04.06.05.49.12 (version=TLSv1/SSLv3 cipher=OTHER); + Fri, 06 Apr 2012 05:49:13 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v3 1/6] lib: change default for + notmuch_query_set_omit_excluded +Date: Fri, 6 Apr 2012 13:49:06 +0100 +Message-Id: <1333716551-29153-2-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1333716551-29153-1-git-send-email-markwalters1009@gmail.com> +References: <1333716551-29153-1-git-send-email-markwalters1009@gmail.com> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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: Fri, 06 Apr 2012 12:49:16 -0000 + +--- + lib/notmuch.h | 23 ++++++++++++++++++----- + lib/query.cc | 10 +++++----- + 2 files changed, 23 insertions(+), 10 deletions(-) + +diff --git a/lib/notmuch.h b/lib/notmuch.h +index babd208..673c423 100644 +--- a/lib/notmuch.h ++++ b/lib/notmuch.h +@@ -449,12 +449,25 @@ typedef enum { + const char * + notmuch_query_get_query_string (notmuch_query_t *query); + +-/* Specify whether to results should omit the excluded results rather +- * than just marking them excluded. This is useful for passing a +- * notmuch_messages_t not containing the excluded messages to other +- * functions. */ ++/* Specify whether to omit excluded results or simply flag them. By ++ * default, this is set to TRUE. ++ * ++ * If this is TRUE, notmuch_query_search_messages will omit excluded ++ * messages from the results. notmuch_query_search_threads will omit ++ * threads that match only in excluded messages, but will include all ++ * messages in threads that match in at least one non-excluded ++ * message. ++ * ++ * The performance difference when calling ++ * notmuch_query_search_messages should be relatively small (and both ++ * should be very fast). However, in some cases, ++ * notmuch_query_search_threads is very much faster when omitting ++ * excluded messages as it does not need to construct the threads that ++ * only match in excluded messages. ++ */ ++ + void +-notmuch_query_set_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit); ++notmuch_query_set_omit_excluded (notmuch_query_t *query, notmuch_bool_t omit_excluded); + + /* Specify the sorting desired for this query. */ + void +diff --git a/lib/query.cc b/lib/query.cc +index 68ac1e4..e9c1a2d 100644 +--- a/lib/query.cc ++++ b/lib/query.cc +@@ -28,7 +28,7 @@ struct _notmuch_query { + const char *query_string; + notmuch_sort_t sort; + notmuch_string_list_t *exclude_terms; +- notmuch_bool_t omit_excluded_messages; ++ notmuch_bool_t omit_excluded; + }; + + typedef struct _notmuch_mset_messages { +@@ -92,7 +92,7 @@ notmuch_query_create (notmuch_database_t *notmuch, + + query->exclude_terms = _notmuch_string_list_create (query); + +- query->omit_excluded_messages = FALSE; ++ query->omit_excluded = TRUE; + + return query; + } +@@ -104,9 +104,9 @@ notmuch_query_get_query_string (notmuch_query_t *query) + } + + void +-notmuch_query_set_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit) ++notmuch_query_set_omit_excluded (notmuch_query_t *query, notmuch_bool_t omit_excluded) + { +- query->omit_excluded_messages = omit; ++ query->omit_excluded = omit_excluded; + } + + void +@@ -220,7 +220,7 @@ notmuch_query_search_messages (notmuch_query_t *query) + if (query->exclude_terms) { + exclude_query = _notmuch_exclude_tags (query, final_query); + +- if (query->omit_excluded_messages) ++ if (query->omit_excluded) + final_query = Xapian::Query (Xapian::Query::OP_AND_NOT, + final_query, exclude_query); + else { +-- +1.7.9.1 + -- 2.26.2