From 5c5a40a6e75d5a9c91fbd2801827346b3b558ee7 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Tue, 20 Mar 2012 20:12:00 +0000 Subject: [PATCH] [WIP 2/2] cli: search: multithread --- 7b/5dfc8d52ae2095372768e0553e86913135d2d1 | 120 ++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 7b/5dfc8d52ae2095372768e0553e86913135d2d1 diff --git a/7b/5dfc8d52ae2095372768e0553e86913135d2d1 b/7b/5dfc8d52ae2095372768e0553e86913135d2d1 new file mode 100644 index 000000000..368ded1e7 --- /dev/null +++ b/7b/5dfc8d52ae2095372768e0553e86913135d2d1 @@ -0,0 +1,120 @@ +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 66FB9431FAF + for ; Tue, 20 Mar 2012 13:12:18 -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 ITmw5av-scoI for ; + Tue, 20 Mar 2012 13:12:16 -0700 (PDT) +Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com + [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id E8407431FCF + for ; Tue, 20 Mar 2012 13:12:09 -0700 (PDT) +Received: by wibhq7 with SMTP id hq7so4620566wib.2 + for ; Tue, 20 Mar 2012 13:12:08 -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=pYcJA5VPsqPPDjf0Wt9fVZi9BDODpIN4pVN6nXuWnYM=; + b=f448S5cfeV/GXdlwQYne+Iw3eN6LYFLmmSAIBTkvQTbip5yDYmTd69MlpYdgcMTt8r + kRXKhSEC4PnBEBbRD8gMarHSSLSSapackSFTraCosotbcZHUYaA1GF+Q7vWbXbX3Js2x + 92P19O73W+Z3UX+woE14p0zIADtJkpND+dXsPbPPqQ8ypahMbOEYJE88O6TrjuTLVDrp + 6cI6f/Ri5srRqcgu0wGONeko2WPilA7XKq5ZpyMHiuIiyfkGIDBl1C2jskJb6cfPnv4P + fKgPpUjzm2wqrb5SltfqhDBVP1xoz+kmb71Yy7lMmPmzUPzvvFTBPKY+kBJTnVOk5AB6 + kjdQ== +Received: by 10.180.95.1 with SMTP id dg1mr2681125wib.21.1332274328652; + Tue, 20 Mar 2012 13:12:08 -0700 (PDT) +Received: from localhost (94-192-233-223.zone6.bethere.co.uk. + [94.192.233.223]) by mx.google.com with ESMTPS id + k6sm36519566wie.9.2012.03.20.13.12.07 (version=TLSv1/SSLv3 cipher=OTHER); + Tue, 20 Mar 2012 13:12:08 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [WIP 2/2] cli: search: multithread +Date: Tue, 20 Mar 2012 20:12:00 +0000 +Message-Id: <1332274320-17487-3-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1332274320-17487-1-git-send-email-markwalters1009@gmail.com> +References: <1332274320-17487-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: Tue, 20 Mar 2012 20:12:18 -0000 + +--- + notmuch-search.c | 19 +++++++++++++++++++ + 1 files changed, 19 insertions(+), 0 deletions(-) + +diff --git a/notmuch-search.c b/notmuch-search.c +index f6061e4..2fa4231 100644 +--- a/notmuch-search.c ++++ b/notmuch-search.c +@@ -436,6 +436,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) + int offset = 0; + int limit = -1; /* unlimited */ + notmuch_bool_t no_exclude = FALSE; ++ notmuch_bool_t secondary_search = FALSE; ++ char *secondary_search_terms = NULL; ++ notmuch_ss_conjunction_t ss_conjunction = NOTMUCH_SECONDARY_SEARCH_NONE; + unsigned int i; + + enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT } +@@ -458,6 +461,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) + { "tags", OUTPUT_TAGS }, + { 0, 0 } } }, + { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 }, ++ { NOTMUCH_OPT_BOOLEAN, &secondary_search, "secondary-search", 'd', 0 }, + { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 }, + { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 }, + { 0, 0, 0, 0, 0 } +@@ -478,6 +482,18 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) + break; + } + ++ if (secondary_search && argc-opt_index >= 2 ) { ++ if (strcmp (argv[argc - 2], ":AND:") == 0) ++ ss_conjunction = NOTMUCH_SECONDARY_SEARCH_AND; ++ if (strcmp (argv[argc - 2], ":AND_NOT:") == 0) ++ ss_conjunction = NOTMUCH_SECONDARY_SEARCH_AND_NOT; ++ ++ if (ss_conjunction != NOTMUCH_SECONDARY_SEARCH_NONE) { ++ secondary_search_terms = argv[argc - 1]; ++ argc -= 2; ++ } ++ } ++ + config = notmuch_config_open (ctx, NULL, NULL); + if (config == NULL) + return 1; +@@ -505,6 +521,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) + + notmuch_query_set_sort (query, sort); + ++ if (secondary_search_terms) ++ notmuch_query_set_secondary_search (query, secondary_search_terms, ss_conjunction); ++ + if (!no_exclude) { + const char **search_exclude_tags; + size_t search_exclude_tags_length; +-- +1.7.9.1 + -- 2.26.2