[WIP 2/2] cli: search: multithread
authorMark Walters <markwalters1009@gmail.com>
Tue, 20 Mar 2012 20:12:00 +0000 (20:12 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:38 +0000 (09:45 -0800)
7b/5dfc8d52ae2095372768e0553e86913135d2d1 [new file with mode: 0644]

diff --git a/7b/5dfc8d52ae2095372768e0553e86913135d2d1 b/7b/5dfc8d52ae2095372768e0553e86913135d2d1
new file mode 100644 (file)
index 0000000..368ded1
--- /dev/null
@@ -0,0 +1,120 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 66FB9431FAF\r
+       for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 13:12:18 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id ITmw5av-scoI for <notmuch@notmuchmail.org>;\r
+       Tue, 20 Mar 2012 13:12:16 -0700 (PDT)\r
+Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com\r
+       [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id E8407431FCF\r
+       for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 13:12:09 -0700 (PDT)\r
+Received: by wibhq7 with SMTP id hq7so4620566wib.2\r
+       for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 13:12:08 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=pYcJA5VPsqPPDjf0Wt9fVZi9BDODpIN4pVN6nXuWnYM=;\r
+       b=f448S5cfeV/GXdlwQYne+Iw3eN6LYFLmmSAIBTkvQTbip5yDYmTd69MlpYdgcMTt8r\r
+       kRXKhSEC4PnBEBbRD8gMarHSSLSSapackSFTraCosotbcZHUYaA1GF+Q7vWbXbX3Js2x\r
+       92P19O73W+Z3UX+woE14p0zIADtJkpND+dXsPbPPqQ8ypahMbOEYJE88O6TrjuTLVDrp\r
+       6cI6f/Ri5srRqcgu0wGONeko2WPilA7XKq5ZpyMHiuIiyfkGIDBl1C2jskJb6cfPnv4P\r
+       fKgPpUjzm2wqrb5SltfqhDBVP1xoz+kmb71Yy7lMmPmzUPzvvFTBPKY+kBJTnVOk5AB6\r
+       kjdQ==\r
+Received: by 10.180.95.1 with SMTP id dg1mr2681125wib.21.1332274328652;\r
+       Tue, 20 Mar 2012 13:12:08 -0700 (PDT)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223])     by mx.google.com with ESMTPS id\r
+ k6sm36519566wie.9.2012.03.20.13.12.07 (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Tue, 20 Mar 2012 13:12:08 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [WIP 2/2] cli: search: multithread\r
+Date: Tue, 20 Mar 2012 20:12:00 +0000\r
+Message-Id: <1332274320-17487-3-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1332274320-17487-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1332274320-17487-1-git-send-email-markwalters1009@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 20 Mar 2012 20:12:18 -0000\r
+\r
+---\r
+ notmuch-search.c |   19 +++++++++++++++++++\r
+ 1 files changed, 19 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/notmuch-search.c b/notmuch-search.c\r
+index f6061e4..2fa4231 100644\r
+--- a/notmuch-search.c\r
++++ b/notmuch-search.c\r
+@@ -436,6 +436,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+     int offset = 0;\r
+     int limit = -1; /* unlimited */\r
+     notmuch_bool_t no_exclude = FALSE;\r
++    notmuch_bool_t secondary_search = FALSE;\r
++    char *secondary_search_terms = NULL;\r
++    notmuch_ss_conjunction_t ss_conjunction = NOTMUCH_SECONDARY_SEARCH_NONE;\r
+     unsigned int i;\r
+ \r
+     enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }\r
+@@ -458,6 +461,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+                                 { "tags", OUTPUT_TAGS },\r
+                                 { 0, 0 } } },\r
+       { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },\r
++      { NOTMUCH_OPT_BOOLEAN, &secondary_search, "secondary-search", 'd', 0 },\r
+       { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },\r
+       { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0  },\r
+       { 0, 0, 0, 0, 0 }\r
+@@ -478,6 +482,18 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+       break;\r
+     }\r
+ \r
++    if (secondary_search && argc-opt_index >= 2 ) {\r
++      if (strcmp (argv[argc - 2], ":AND:") == 0)\r
++          ss_conjunction = NOTMUCH_SECONDARY_SEARCH_AND;\r
++      if (strcmp (argv[argc - 2], ":AND_NOT:") == 0)\r
++          ss_conjunction = NOTMUCH_SECONDARY_SEARCH_AND_NOT;\r
++\r
++      if (ss_conjunction != NOTMUCH_SECONDARY_SEARCH_NONE) {\r
++          secondary_search_terms = argv[argc - 1];\r
++          argc -= 2;\r
++      }\r
++    }\r
++\r
+     config = notmuch_config_open (ctx, NULL, NULL);\r
+     if (config == NULL)\r
+       return 1;\r
+@@ -505,6 +521,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+ \r
+     notmuch_query_set_sort (query, sort);\r
+ \r
++    if (secondary_search_terms)\r
++      notmuch_query_set_secondary_search (query, secondary_search_terms, ss_conjunction);\r
++\r
+     if (!no_exclude) {\r
+       const char **search_exclude_tags;\r
+       size_t search_exclude_tags_length;\r
+-- \r
+1.7.9.1\r
+\r